All Questions
Tagged with legend matplotlib
1,030
questions
329
votes
11
answers
443k
views
Remove the legend on a matplotlib figure
To add a legend to a matplotlib plot, one simply runs legend().
How to remove a legend from a plot?
(The closest I came to this is to run legend([]) in order to empty the legend from data. But that ...
1
vote
1
answer
1k
views
Legend colors in Matplotlib table function?
Does anyone know if it's possible to take the standard color boxes in the legend function in Matplotlib, and put those boxes in the rows of a table?
For example, look at this chart:
http://www....
481
votes
11
answers
480k
views
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
...
1
vote
1
answer
709
views
Draggable legend with multiple axes problem
I’m wondering if anyone has a solution for a problem I’m having when using a draggable legend in conjunction with multiple axes.
I’m using gridspec and figure (matplotlib 1.0.1, qt4 backend) to ...
5
votes
1
answer
4k
views
Matplotlib Legend Height in pixels
I need to know the size of the legend in pixels. I seem to only be able to get height = 1. from any function... I've tried the following
this returns 1.
height = legend.get_frame()....
2
votes
1
answer
3k
views
How to reduce the font of the text in the legend box printed in the plot?
I am trying to plot around 10 plots in a single figure. I also could put the legend box separately. But, I am unable to reduce the size of the font in the legend box. Can anybody suggest me the ...
1660
votes
18
answers
1.9m
views
How to put the legend outside the plot
I have a series of 20 plots (not subplots) to be made in a single figure. I want the legend to be outside of the box. At the same time, I do not want to change the axes, as the size of the figure gets ...
3
votes
1
answer
4k
views
matplotlib numbers in legend
I have a couple of lines and I want to show a legend. The problem is, I can't use different styles (--, :, -.) because there are too few of them, and I can't use markers (+, *, etc.) because I need ...
3
votes
1
answer
7k
views
Matplotlib legend help
I am writing a script that plot's several points. I am also trying to create a legend from these points. To sum up my script, I am plotting several 'types' of points (call them 'a', 'b', 'c'). These ...
43
votes
3
answers
15k
views
How to create a draggable legend in matplotlib?
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 draggable by ...