Issue
So here is my python code.
import matplotlib.pyplot as plt
M=[]
for i in np.arange(0.01,8,0.01):
M.append(test(i))
plt.plot(M)
plt.grid(b=True,which="major",color='#666666', linestyle='-',linewidth=0.2)
plt.show()
Where test(x) is some complicated function. When i try to plot it python for some plots on X-axis from 1 to 800, but i want have scaled it plot from 0.01 to 8. So scaled down without changing graph. Due to complicated form of test(x) function, i would like to use arrays, and this method of ploting.
Solution
Add an index to plot against (essentially your x-axis values):
import matplotlib.pyplot as plt
M=[]
indices = []
for i in np.arange(0.01,8,0.01):
M.append(test(i))
indices.append(i)
plt.plot(indices, M)
plt.grid(b=True,which="major",color='#666666', linestyle='-',linewidth=0.2)
plt.show()
Answered By - spaghettibaguetti
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.