Python Forum

Full Version: rotate error function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.

[attachment=2142]