Python Forum

Full Version: Plot several graphs in one plot
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I will use an easy example to ask my question:

time1=[1,2,3,4,5,6] (sek)
time2=[0.5,2,5,6,7.5,8.6,10] (sek)

y1=[20,40,60,80,90,100] (N)
y2=[10,15,30,60,70,90,110] (N)

Both time-arrays and y-arrays have the same units, but they have different lengths and values.
Is it possible to plot them together so that they can be compared directly? - meaning: plt.plot(time1, y1) and plt.plot(time2, y2) plotted together

Thank you
It is possible, even easy. What have you tried?

Matplotlib has examples for doing almost anything. You can look at the examples:

https://matplotlib.org/stable/gallery/index.html

or tutorials:

https://matplotlib.org/stable/tutorials/...-pyplot-py