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

matplotlib add legend axis x

fig = plt.figure(figsize=(10,5))
ax = fig.add_subplot(111)
ax.set_title('ADR vs Rating (CS:GO)')
ax.scatter(x=data[:,0],y=data[:,1],label='Data')
plt.plot(data[:,0], m*data[:,0] + b,color='red',label='Our Fitting 
Line')
ax.set_xlabel('ADR')
ax.set_ylabel('Rating')
ax.legend(loc='best')
plt.show()
Comment

position of legend matplotlib

plt.legend(loc='upper right')
Comment

plt.legend(

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

matplotlib position legend

plt.legend(loc='best')
plt.legend(loc='upper right')
plt.legend(loc='Center left')
plt.legend(loc='Upper center')
# etc.
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 unicode function 
Python :: how to get ping from computer IN PYTHON 
Python :: django set cookie 
Python :: why python stops after plt.show() 
Python :: splitting on basis of regex python 
Python :: #Check if list1 contains all elements of list2 using all() 
Python :: been deprecated, please pass in a Service object 
Python :: how to install pandas for aws sam local 
Python :: select inverse with conditions pandas 
Python :: /n python 
Python :: how to install qrcode module in python 
Python :: hide grid imshow 
Python :: python program to check whether a specified value is contained in a group of values 
Python :: python sum certain postions of array 
Python :: how to set date and time rows in order python pandas 
Python :: pandas and operator 
Python :: WSGIPassAuthorization on 
Python :: pandas data frame from part of excel better example 
Python :: python use negation with maskedarray 
Python :: what is cpython 
Python :: python extraer ultimo elemento lista 
Python :: find email address pytho 
Python :: menor valor lista python 
Python :: how to use with statementin python 2.4 
Python :: pandas cumsum 
Python :: python serial COM3 
Python :: python3 conditional with boolean 
Python :: 151 - Power Crisis solution in python 
Python :: bytestring python 
Python :: @methodclass in python 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =