About 398,000 results
Open links in new tab
  1. 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__': …

  2. 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 …

  3. python - Reverse the order of a legend - Stack Overflow

    26 The newest version of matplotlib (>=3.7) now provides this feature out of the box: plt.legend(title="Line", loc='upper left', reverse=True) The default is reverse=False (the …

  4. How to place two different legends on the same graph

    You can first create your set of legends, and then add them to the axes you want with the method "add_artist". Also, I am starting with matplotlib, and for me at least it is easier to understand …

  5. How do I make a single legend for many subplots? - Stack Overflow

    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,

  6. How do you create a legend for a contour plot? - Stack Overflow

    Jun 3, 2022 · set_label() does not render correctly with matplotlib 3.5.2. Use solutions below or legend_elements().

  7. How to specify legend position in graph coordinates

    27 According to the matplotlib legend documentation: The location can also be a 2-tuple giving the coordinates of the lower-left corner of the legend in axes coordinates (in which case …

  8. How to add legend to imshow() in matplotlib - Stack Overflow

    Aug 25, 2014 · 20 I am using matplotlib In plot() or bar(), we can easily put legend, if we add labels to them. but what if it is a contourf() or imshow() I know there is a colorbar() which can …

  9. 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...

  10. How to change legend fontsize with matplotlib.pyplot

    138 using import matplotlib.pyplot as plt Method 1: specify the fontsize when calling legend (repetitive) plt.legend(fontsize=20) # using a size in points plt.legend(fontsize="x-large") # …