Reputation: 103
I am new to python and I am trying to plot in a graph in python, but the plot on y-axis is not completely visible. I need to increase the y-limits from -1000 to 7. But, matplotlib cuts the graph above 0 in case I specify such high ylimits. And if I specify smaller limits like -10 to 10, it doesn't show the complete graph on negative y-axis. I tried to save figure using tight layout but that also did not help.
I am using Python 3.6.3 and Jupyter notebook.
Below are the graphs for plt.ylim(-10, 5.5) and plt.ylim(-1000, 5.5), respectively.
Is there anyway to increase the y-limits to very high so that the whole graph is visible?
Here is my code snippet for the graph:
plt.plot(tVec,psp,'b',linewidth=2,label='PSP')
plt.ylim(-10, 5.5)
plt.xlabel("Time (ms)")
plt.ylabel("PSP")
plt.legend()
plt.savefig("test.png",bbox_inches='tight')
plt.show()
Upvotes: 0
Views: 1069
Reputation: 51
If you want to see the y axis as a logarithmic one (Wikipedia Logarithmic Scale) you could set it up with plt.yscale('log')
Upvotes: 1