I would like this function to take a string, indicating which data(x, y or z) it should plot, as an argument.
def plotfit(axis):
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
ax.scatter(xdata, ydata, func_z(vars,fitted_z),c='r')
ax.set_title('B_z of %s' % name)
ax.scatter(xdata, ydata, zfield, c='b')
How do I make the bolded parts of the code below replaced by my string argument so that, e.g. plotfit(x) would replace all instances of bolded z below with "x" and plot accordingly ? Points of interest:
- func_z
- fitted_z
- zfield
- 'B_z of %s'
What I imagine would be something along the lines of:
ax.scatter(xdata, ydata, func(axis as a string)(vars,fitted_(axis as a string)),c='r')