I currently plot a graph with matplotlib.pyplot. I have some data and the data never reaches zero. Sometimes it's very close with 1e-19 or so but it never reaches it. Now I am plotting the data with log scale:
ax = fig.add_axes([0,0,1,1])
ax.plot(x,ye15, label='1e15')
ax.plot(x,ye16, label='1e16')
ax.plot(x,ye17, label='1e17')
ax.plot(x,ye18, label='1e18')
ax.plot(x,ye19, label='1e19', marker='o')
ax.set_xlabel('Voltage in V')
ax.set_ylabel('Current in mA')
ax.set_title('IV')
legend = ax.legend()
ax.set_yscale("log")
ax.set_ylim(1e-21, 1e-7)
fig
The problem is now I get weird vertical lines so matplotlib doesn't correctly connect the points. What should I do to fix this?
Without the log scale and without a zoom into the data the result looks like this:
After the log scale and zoom has been applied it looks like this
The Data between -0.5 and -0.2 looks like this:
Thanks Kevin
Result: I have some negative values and they lead to the nan values in the log scale. Solution: Make all numbers positive