Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to add legend on side of the chart python

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(10)

fig = plt.figure()
ax = plt.subplot(111)

for i in xrange(5):
    ax.plot(x, i * x, label='$y = %ix$' % i)
 
ax.legend(bbox_to_anchor=(1.1, 1.05))  # ← add this line

plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: tkinter video 
Python :: relative frequency histogram python 
Python :: tensorflow create custom initializer 
Python :: jupyter read excel 
Python :: pandas get tuples from dataframe 
Python :: csrf token django 
Python :: DIF_GCD solution 
Python :: python convert float to whole part of number 
Python :: python types of loops 
Python :: importing logistic regression 
Python :: python Sum of all the factors of a number 
Python :: uninstall python ubuntu 18.04 
Python :: How to make a function repeat itself a specifc amount of times python 
Python :: python requests insecure request warning 
Python :: python concatenate dictionaries 
Python :: return foreignkey attribute django rest 
Python :: calculating auc 
Python :: repl.it install packages python 
Python :: how to delete a column in pandas dataframe 
Python :: upper python python.org 
Python :: Renaming and replacing the column variable name 
Python :: python ceil method 
Python :: reload class module python 
Python :: tuple to string python 
Python :: free wifi connection disconnects frequently windows 10 
Python :: python count how many times a word appears in a string 
Python :: python output text 
Python :: looping over lists in python 
Python :: python Using for loop and list comprehension 
Python :: swapping upper case and lower case string python 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =