python - Plotting a curve from numpy array with large values -
i trying plot curve molecular dynamics potential energies data stored in numpy array. can see figure attached, on top left of figure, large number appears related label on y-axis. @ it. if rescale data, still number appears there. not want it. please can suggest me howto sort out issue? thank much..
this happening because data small value offset large one. that's -
sign means @ front of number, "take plotted y-values , subtract number actual values". can remove plotting mean subtracted. here's example:
import numpy np import matplotlib.pyplot plt y = -1.5*1e7 + np.random.random(100) plt.plot(y) plt.ylabel("units")
but subtracting mean (or other number close that, min
or max
, etc) remove large offset:
plt.figure() plt.plot(y - np.mean(y)) plt.ylabel("offset units") plt.show()
Comments
Post a Comment