
python - Adding a matplotlib legend - Stack Overflow
How can one create a legend for a line graph in Matplotlib's PyPlot without creating any extra variables? Please consider the graphing script below: if __name__ == '__main__': …
python - How to manually create a legend - Stack Overflow
I am using matplotlib and I would like to manually add items to the legend that are a color and a label. I am adding data to to the plot to specifying there would lead to a lot of duplicates. My th...
python - How to put the legend outside the plot - Stack Overflow
seaborn is a high-level api for matplotlib. From seaborn v0.11.2, there is sns.move_legend as shown at Move seaborn plot legend to a different position. All of the parameters for .legend …
python - How do I assign multiple legend labels at once ... - Stack ...
I really don't want to plot the data in a loop, and multiple calls to ax.legend / plt.legend are not really an option, since I want to plot other stuff, usually in an equally annoying format.
python - How to specify legend position in graph coordinates
plt.legend(loc=(x, y)) to set the legend's lower left corner to the specified (x, y) position. Note that the x and y coordinates here are relative, meaning that x=0 is the left most point in the plot and …
python - Matplotlib: how to show legend elements horizontally?
Mar 4, 2019 · I'd like to set the legend to be displayed horizontally. I do not mean the text of the legend like described in the post Matplotlib legend vertical rotation. My actual case includes an …
python - How do I make a single legend for many subplots
I am plotting the same type of information, but for different countries, with multiple subplots with Matplotlib. That is, I have nine plots on a 3x3 grid, all with the same for lines (of course,
python - Show only certain items in legend - Stack Overflow
Mar 19, 2019 · I currently am plotting a stacked bar graph of a large amount of taxonomic data, and only wish to show significant species in the legend (out of ~500 I wish to show ~25). Is …
python - Remove or adapt border of frame of legend using …
Aug 28, 2014 · When plotting a plot using matplotlib: How to remove the box of the legend? How to change the color of the border of the legend box? How to remove only the border of the box …
python - Matplotlib Legend Wont Show Up - Stack Overflow
Mar 28, 2020 · Calling plt.legend() without specifying the handles or labels explicitly obeys the description of this call signature outlined here: The elements to be added to the legend are …