0

I am trying to graph multiple lines in matplotlib.

I have used to the label function but it is not displaying it.

Here is my code.

import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.pyplot import plot

adani = pd.read_csv(r'F:\Pycharm_projects\pytorch_bliztz\nifty50-stock-market-data\ADANIPORTS.csv')
asianpaint = pd.read_csv(r'F:\Pycharm_projects\pytorch_bliztz\nifty50-stock-market-data\ASIANPAINT.csv')
adani1 = adani.High
asian_paint = asianpaint.High
plt.plot(asian_paint, label="asian_paint")
plt.plot(adani1, label='adaini1')

plt.show()

Here is my image:

enter image description here

swiss_knight
  • 5,787
  • 8
  • 50
  • 92

1 Answers1

0

You need to add the following command after plotting

plt.legend()
Sheldore
  • 37,862
  • 7
  • 57
  • 71