Skip to main content

All Questions

Tagged with
0 votes
0 answers
34 views

Matplotlib legend position for graphs

x = ['TPhP', 'TPrP', 'THP', 'OEP', 'Aristophyll A', 'TETMP', 'DMDHP', 'THDPP', 'BDTDP'] plt.xticks(range(len(x)), x, rotation='vertical') plt.ylim([-6, 12]) y1 = [-3.8681, -3.7851, -3.6178, -3....
Sivanujan Suthaharan's user avatar
0 votes
1 answer
91 views

Why is there multiple indentical entries in a legend when plotting with matplotlib? [duplicate]

I try to plot a list a of values with respect to time and I have two examples: one where Im plotting angular velocities and the other where Im plotting linear accelerations. For both graphs the code ...
SvylantisCPU's user avatar
-1 votes
1 answer
367 views

Use variables in legend handles

I want to graph multiple different bar charts and the colors in each graph will vary depending on the data being plotted. I would like to have a legend with handles (to accompany each set of data and ...
Eric Q's user avatar
  • 19
0 votes
1 answer
194 views

How to remove duplicates and move the legend list to outside of the graph concurrently?

I have seen many good questions questions and answers, but I am not sure how to combine two of them: How to put the legend outside the plot Duplicate items in legend in matplotlib? These two ...
DialFrost's user avatar
  • 1,709
1 vote
1 answer
2k views

How to remove a legend part of a seaborn facetgrid

In Matplotlib/seaborn I create a facetgrid with the relplot command where the data attribute use for therow parameter is also used for the style attribute. This leads to a legend with two parts. One ...
halloleo's user avatar
  • 9,924
2 votes
1 answer
720 views

Is it possible to use matplotlib legend picker selecting legend text area not legend line?

I want to make a graph using matplotlib. I would like to add a picker function so I can find a code from this matplotlib URL: https://matplotlib.org/stable/gallery/event_handling/legend_picking.html ...
LeeJunYoung's user avatar
0 votes
0 answers
941 views

Fancybox is not working. What am I doing wrong?

I was following an example from Python Data Science Handbook which is plotting a simple graph. Its supposed to use fancybox on labels but it is not working as per the example. The code is: x = np....
omsinghml's user avatar
1 vote
0 answers
282 views

Matplotlib same LaTeX format for text and float-to-string part

I am trying to work on the legend of my graph: As you can see that I used the dollar symbol for timestep to make it latex (I hope I am not wrong) but I am unable to get the same font/format for the ...
MMM's user avatar
  • 11
0 votes
1 answer
707 views

How do you add more than one element to a Matplotlib legend?

I can't seem to figure out how to add more than one element to the legend of my line graph. I've attached my graph here, and any help would be appreciated! Here's my code: fig1 = figure() ax0 = ...
Ellen's user avatar
  • 1
1 vote
1 answer
89 views

Putting two different entries under same label in a legend

I have plotted a graph with different data sets and trend lines. I was wondering if it was possible to have two different entries under the same label without the label appearing twice in the legend: ...
Oliver Moore's user avatar
1 vote
1 answer
1k views

Matplotlib Axes legend shows only one label in barh

I have 15 barh subplots that looks like this: I can't seem to get the legend working, so I'll see [2,3,4] as separate labels in the graph and in the legend. I'm having trouble with making this work ...
TheCrystalShip's user avatar
3 votes
0 answers
8k views

Python- Change legend position in plot [duplicate]

I want to change legend position because legend names a little bit longer(X Position according to ...) so that I want to put this name vertical (right side of graph or under the plot). I have three ...
Ugur's user avatar
  • 111
1 vote
0 answers
1k views

Matplotlib graph annotation legend [duplicate]

My code: fig = plt.figure(figsize=(15,8)) ax = fig.add_subplot(111) ax.annotate('9.15.08: Lehman Brothers', xy=('2008-09-15', 180.00), arrowprops=dict(facecolor='blue', shrink=0.5),) ax....
Mark's user avatar
  • 11
6 votes
3 answers
10k views

How do I change the size of the scatter markers in the legend?

I am basically plotting a scatter graph with matplotlib, however, I have varied each point by a radius. When I use plt.legend() to show my legend, it looks like this...... Is there a command to ...
mcstosh's user avatar
  • 91
0 votes
1 answer
3k views

Suppressing a MatPlotLib benign warning [duplicate]

I'm plotting a few different graphs, and I don't want to have a legend since I don't need it. ax.scatter(x, y, ..., label='') The above works just fine for me, but it sends a UserWarning out. I ...
Rikg09's user avatar
  • 185

15 30 50 per page