draw vertical line in matplotlib code example
Example 1: python add vertical line in plot
plt.axvline(x_coordinate)
import matplotlib.pyplot as plt
plt.figure(figsize=(5, 5))
plt.axvline(x=10, ymin=0.10, ymax=0.70, color='b', ls='--', lw=1.5, label='axvline - % of full height')
plt.legend(bbox_to_anchor=(1.0, 1), loc='best')
plt.show()
Example 2: vertical line in matplotlib
xposition = [0.3, 0.4, 0.45]
for xc in xposition:
plt.axvline(x=xc, color='k', linestyle='--')
Example 3: add vertical line in plot python
pythonCopymatplotlib.pyplot.axvline(x=0, ymin=0, ymax=1, hold=None, **kwargs)