Python Forum
rotate error function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
rotate error function
#1
I would like to rotate a function that is defined in terms of the error function, see here. I am unsure how to go about it, but I would like the resulting plot to be diagonal along the line y=-bx, where b is some arbitrary positive constant. Here is the code so far; increasing cx and cy stretches the graph in the y-direction and x-direction respectively.

from scipy import special
import numpy as np
import matplotlib.pyplot as plt

u0=200
r0x=25
r0y=25
rmax=5.5
alpha=2
t=2
cx=20
cy=1

y, x = np.meshgrid(np.linspace(0, 50, 100), np.linspace(0, 50, 100))
r=np.sqrt(cx*(x-r0x)**2+cy*(y-r0y)**2)
z=u0*(special.erf((rmax-r)/np.sqrt(4*alpha*t))-special.erf((-rmax-r)/np.sqrt(4*alpha*t)))

plt.pcolormesh(x, y, z, cmap='jet')
plt.xlim(x.min(), x.max())
plt.ylim(y.min(), y.max())
plt.xlabel('x')
plt.ylabel('y')
plt.title(f'Temperature at {t} [arb. unit]')
cbar=plt.colorbar()
cbar.set_label('Temperature')
plt.clim(0,200)
Below is the output.

   
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  edit rotate function to consider capitalized letter wak_stephanie 2 2,465 Aug-31-2018, 11:14 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020