About 51 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__': PyPlot.plot(length,

  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 can be passed to …

  3. How to specify legend position in graph coordinates

    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 bbox_to_anchor …

  4. 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 present the color …

  5. matplotlib - Python legend in 3dplot - Stack Overflow

    Jan 18, 2016 · Why do you want separate plot and scatter plot calls? If the points in scatter are the same ones in plot then set a marker in the plot call, if they're not the same points then they should probably …

  6. How to create a draggable legend in matplotlib? - Stack Overflow

    Mar 29, 2010 · I'm drawing a legend on an axes object in matplotlib but the default positioning which claims to place it in a smart place doesn't seem to work. Ideally, I'd like to have the legend be …

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

  8. python - How can I have a matplotlib legend span the plot areas of the ...

    Aug 12, 2025 · I want to have the shared legend of multiple subplots take the width of the plot areas of the subplots. Here is an illustration: Here's what I tried / a minimum reproducible example of what I …

  9. How to modify matplotlib legend after it has been created?

    Jan 23, 2015 · I've written a function modify_legend which modifies a legend after it has been created. It basically reads all the parameters from the already created legend, updates it with the key-value …

  10. python - Matplotlib legend for an arrow - Stack Overflow

    Nov 6, 2015 · Matplotlib legend for an arrow Asked 12 years ago Modified 4 years, 9 months ago Viewed 24k times