I want to plot a vertical line in my matplotlib loglog plot, but they line never shows up. I tried two methods and both fail. How do I do it?
So toy example:
import numpy as np
import matplotlib.pyplot as plt
N = 1000
r= np.random.randn(N)
x = np.exp(0.01 * np.arange(N)) +0.2
y = np.exp(0.4 * (np.arange(N)+r))
plt.loglog(x,y,label="Hello ")
So the above works (except that the legend doesnt show up, so if you know how to solve that bonus points).
But now when I try to add a vertical line:
plt.axvline(x=1.2, color='g')
it doesn't appear. Neither does the following trick work:
ylim = plt.get_ylim()
plot.plot([1.2, 1.2], ylim, 'r--')
What can I do?