About 110,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. python - How to put the legend outside the plot - Stack Overflow

    The legend handles and labels need to obtained from the real plot via h, l = ax.get_legend_handles_labels() and can then be supplied to the legend in the lax subplot, …

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

  4. python - How to change legend fontsize with matplotlib.pyplot

    Simple question here: I'm trying to get the size of my legend using matplotlib.pyplot to be smaller (i.e., the text to be smaller). The code I'm using goes something like this: plot.figure() plot.

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

  6. python - Secondary axis with twinx (): how to add to legend

    I have a plot with two y-axes, using twinx(). I also give labels to the lines, and want to show them with legend(), but I only succeed to get the labels of one axis in the legend: import numpy as np

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

  8. python - How to specify legend position in graph coordinates

    How to put the legend out of the plot However, I'd like to use the coordinates of my x- and y-axis in the graph to specify the legend position (inside the plot), as I might need to move the figure …

  9. python - How do I assign multiple legend labels at once ... - Stack ...

    In case of numpy matrix plot assign multiple legends at once for each column I would like to answer this question based on plotting a matrix that has two columns.

  10. Is it possible to add a string as a legend item - Stack Overflow

    Apr 25, 2023 · I am producing some plots in matplotlib and would like to add explanatory text for some of the data. I want to have a string inside my legend as a separate legend item above …