Horje
how to add legend to python plot Code Example
how to add legend to python plot
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0, 20, 1000)
y1 = np.sin(x)
y2 = np.cos(x)

plt.plot(x, y1, "-b", label="sine")
plt.plot(x, y2, "-r", label="cosine")
plt.legend(loc="upper left")
plt.ylim(-1.5, 2.0)
plt.show()




Python

Related
python move file Code Example python move file Code Example
pandas version from python script Code Example pandas version from python script Code Example
check python 32 or 64 Code Example check python 32 or 64 Code Example
python get script name Code Example python get script name Code Example
how to open incognito tab using webbrowser Code Example how to open incognito tab using webbrowser Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7