Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

matplotlib legend

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()
Comment

plt.legend(

plt.legend(['first', 'second']);
Comment

legend matplotlib


import matplotlib.pyplot as plt

#define x and ysin
plt.plot(x,ysin,label='sin(x)')
plt.legend()
plt.show()
Comment

legend ax matplotlib

ax.plot([1, 2, 3], label='Inline label')
ax.legend()
Comment

PREVIOUS NEXT
Code Example
Python :: python remove consecutive spaces 
Python :: how to create qthread in pyqt5 
Python :: curl python 
Python :: identify total number of iframes with Selenium 
Python :: python console width 
Python :: how to find unique values in a column in pandas 
Python :: registration of path in urls.py for your apps for views 
Python :: stop program python 
Python :: sqlite query in python 
Python :: after groupby how to add values in two rows to a list 
Python :: program for factorial of a number in python 
Python :: lasso regression implementation python 
Python :: standard scaler vs min max scaler 
Python :: initialize dictionary to zero in python 
Python :: delete values with condition in numpy 
Python :: django check if user is admin 
Python :: calculate days between two dates python 
Python :: find duplicates in python list 
Python :: python file open 
Python :: python read in integers separated by spaces 
Python :: python plot multiple lines in same figure 
Python :: urllib3 python 
Python :: sort arr python 
Python :: how to add rows to empty dataframe 
Python :: discord.py say something 
Python :: django app 
Python :: Python NumPy swapaxis Function Syntax 
Python :: Converting uint8 into integers 
Python :: defualt image django 
Python :: valor absoluto en python 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =