Storylines with matplotlib.pyplot

I am trying to plot vertical lines in a log chart

xv1 = 10 plt.semilogy(t,P,'b') plt.semilogy(t,Pb,'r') plt.vlines(xv1,-1,1,color='k',linestyles='solid') plt.xlabel('Time [s]') plt.ylabel('P [Pa]') plt.grid() plt.show() 

Versions are not displayed in the graph (this is done for plt.plot)

Any ideas? Thanks!

+6
source share
1 answer

You can use axvline to build vertical lines that span the entire range of plots. Then your code could read

 xv1 = 10 plt.semilogy(t, P, 'b') plt.semilogy(t, Pb, 'r') plt.axvline(xv1, color='k', linestyle='solid') plt.xlabel('Time [s]') plt.ylabel('P [Pa]') plt.grid() plt.show() 
+12
source

Source: https://habr.com/ru/post/944375/


All Articles