Plot multiple lines on one chart with different style Python matplotlib

Sometimes we need to plot multiple lines on one chart using different styles such as dot, line, dash, or maybe with different colour as well. It is quite easy to do that in basic python plotting using matplotlib library.

We start with the simple one, only one line:

import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
# when you want to give a label
plt.xlabel('This is X label')
plt.ylabel('This is Y label')
plt.show()

Let’s go to the next step, several lines with different colour and different styles.