Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

matplotlib legend from scratch

import matplotlib.lines as mlines
import matplotlib.pyplot as plt

blue_star = mlines.Line2D([], [], color='blue', marker='*', linestyle='None',
                          markersize=10, label='Blue stars')
red_square = mlines.Line2D([], [], color='red', marker='s', linestyle='None',
                          markersize=10, label='Red squares')
purple_triangle = mlines.Line2D([], [], color='purple', marker='^', linestyle='None',
                          markersize=10, label='Purple triangles')

plt.legend(handles=[blue_star, red_square, purple_triangle])

plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: online c compiler and exe file 
Python :: how to change multiple index in list in python 
Python :: extract tables from image python 
Python :: numpy random sin 
Python :: maximum of a list in python recursively 
Python :: glom safely interact with dictionary 
Python :: Combining functions 
Python :: how to get mid time of given time in python 
Python :: godot get the closer node from array 
Python :: vortex core line detection 
Python :: uncompress zip file in pythonanywhere 
Python :: generate pycryptodome salt 
Python :: python evenly spaced integers 
Python :: Algorithm of Broadcasting with NumPy Arrays 
Python :: Python NumPy Shape function example verifying the value of last dimension 
Python :: manipulate sns legend 
Python :: Python NumPy asmatrix Function Example 
Python :: Python NumPy row_stack Function Syntax 
Python :: Python NumPy repeat Function Example Working with 1D array 
Python :: add text to pdf file in python 
Python :: sorting a specific row python 
Python :: beaglebone install python 3.7 
Python :: pymenu example 
Python :: # find all text files in directory or any type of files in directory 
Python :: how to use python telegram filters 
Python :: how can I edit the history in python shell 
Python :: Data Extraction in Python 
Python :: python readlines  
Python :: corpus.fit(sentences, window=10) 
Python :: Creating 2-dimesional array 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =