About 50 results
Open links in new tab
  1. python - Adding a matplotlib legend - Stack Overflow

    Add labels to each argument in your plot call corresponding to the series it is graphing, i.e. label = "series 1" Then simply add Pyplot.legend() to the bottom of your script and the legend will display …

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

  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. How do I make a single legend for many subplots? - Stack Overflow

    handles, labels = plt.gca().get_legend_handles_labels() To remove legends from subplots, see Remove the legend on a matplotlib figure. To merge twinx legends, see Secondary axis with twinx (): how to …

  5. How to put the legend outside the plot - Stack Overflow

    To add to what Christian Alis and Navi already said, you can use the bbox_to_anchor keyword argument to place the legend partially outside the axes and/or decrease the font size. Before you consider …

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

    From matplotlib version 2.1 onwards, you may use a figure legend. Instead of ax.legend(), which produces a legend with the handles from the axes ax, one can create a figure legend

  7. Creating a Colormap Legend in Matplotlib - Stack Overflow

    import numpy as np import matplotlib.pyplot as plt mat = '''SOME MATRIX''' plt.imshow(mat, origin="lower", cmap='gray', interpolation='nearest') plt.show() How do I add a legend showing the …

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

    Nov 6, 2015 · I would like to know how it is possible to label an arrow and show it in the legend of a plot. For instance if I do this arrow(0,1,'dummy',label='My label') legend() I do not see anything in the

  9. How to add legend below subplots in matplotlib? - Stack Overflow

    7 I am trying to add a legend below a 3-column subplot figure. I have tried the following:

  10. python - How to make custom legend - Stack Overflow

    You can chose the artists and labels to display in the legend as follows. You'll need to create custom artists for the elements in the legend that are not actually plotted.