Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

matplotlib custom legends

from matplotlib.lines import Line2D
custom_lines = [Line2D([0], [0], color=cmap(0.), lw=4),
                Line2D([0], [0], color=cmap(.5), lw=4),
                Line2D([0], [0], color=cmap(1.), lw=4)]

fig, ax = plt.subplots()
lines = ax.plot(data)
ax.legend(custom_lines, ['Cold', 'Medium', 'Hot'])
Comment

PREVIOUS NEXT
Code Example
Python :: python using strip trim white sapce 
Python :: Python Import all names 
Python :: convert PIL RGB to opencv BRG 
Python :: simulate gravity in pythpn 
Python :: form field required in django views 
Python :: python string ignore characters 
Python :: pandas convert string to numpy array 
Python :: python unicode function 
Python :: matplotlib ax.annotate color of the arrow 
Python :: Python Add/Change List Elements 
Python :: show only integer values matplotlib 
Python :: extract column of n array 
Python :: how to make input box if else statement in tkinter 
Python :: python find index 
Python :: expanding nebula foobar 
Python :: inverse box-cox transformation python 
Python :: pysimplegui start value 
Python :: alphabeticallly 
Python :: python crosshair overlay 
Python :: unable to import flask pylint 
Python :: merge two list of dictionaries python with string 
Python :: python sepia filter 
Python :: add text to jpg python 
Python :: can i call a python script from a function 
Python :: python order list by multiple index 
Python :: how to call a class from another class python? 
Python :: delete list using slicing 
Python :: reverse string in python without using function 
Python :: python cointegration 
Python :: python toupper 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =