![]() # place legend outside of plot change the right bbox value to move the legend up or down Patches =, , marker='o', color='w', markerfacecolor=v, label=k, markersize=8) for k, v in ems()] # round markers Np.ed(i) # for repeatable sample dataĭata = ', fontsize=11) ![]() Import math import ceil # determine correct number of subplot Import numpy as np # used for random dataįrom matplotlib.patches import Patch # for custom legend - square patchesįrom matplotlib.lines import Line2D # for custom legend - round markers Imports and Test Data import pandas as pd Since the colors will be the same, place one legend to the side of the plots, instead of a legend in every plot.A custom color map needs to be created from the unique 'cat' values for all the dataframes.Because dataframes are being iterated through, there's no guarantee that colors will be mapped the same for each plot.If the dataframes are wide, use to convert them to long form.This example uses a dict of dataframes, but a list of dataframes would be similar.The categories, cat, may be overlapping, but all dataframes don't necessarily contain all values of cat.Created by separating a single dataframe into multiple dataframes. ![]()
0 Comments
Leave a Reply. |