I would like to draw a vertical line with Matpotlib and I\'m using axvline
, but it doesn\'t work.
import sys
import matplotlib
matplotlib.use(\
Your example is not self contained, but I think you need to replace:
plt.axvline(x=4)
with:
ax.axvline(x=4)
You are adding the line to an axis that you are not displaying. Using plt.
is the pyplot interface which you probably want to avoid for a GUI. So all your plotting has to go on an axis like ax.