Here is how you can plot 2 time series into a single graph in Python using matplotlib
library:
main.py466 chars21 lines
This will plot y1
and y2
as two time series from x
starting from 2018-01-01
and ending at 2018-01-04
. plt.plot
function is used to plot both the series on a single graph. plt.xlabel
, plt.ylabel
, and plt.title
functions are used to add labels to X and Y axis and the graph title. plt.legend()
function adds a legend to the plot to distinguish the two time series from each other. Finally, plt.show()
function displays the plot on the screen.
gistlibby LogSnag