Skip to main content

All Questions

Tagged with
1 vote
1 answer
26 views

How do I make one legend for all subplots in a sns.histplot without duplicate labels?

I have a dataframe that I'm plotting using sns.histplot to make ~9 subplots. I do not want the figure to have 9 legends. I'd like 1 legend for the entire figure, since most of the legends are ...
rcpi's user avatar
  • 51
1 vote
0 answers
39 views

Text shifted in legend because of LaTeX formatting in matplotlib

For some reason in my subplot, the legend of the second ax is cropped at the bottom inside of the legend box. It seems the index causes the text to shift a bit. The legend box itself is perfectly fine....
Chris Ze Third's user avatar
1 vote
0 answers
33 views

How to add a FancyBbox as a legend?

As per the title, I'm trying to add a list of fancy bboxes to a legend : https://matplotlib.org/stable/gallery/shapes_and_collections/fancybox_demo.html. I tried the code below but there is a problem. ...
VERBOSE's user avatar
  • 1,105
0 votes
0 answers
37 views

Putting Legend completely outside the plot in right center

I am trying to create a plot where the legend will be in the right center but completely outside the plot. I am following this answer https://stackoverflow.com/a/75453792/3587282 and using Matplotlib ...
melatonin15's user avatar
  • 2,199
0 votes
1 answer
48 views

Seaborn catplot legend's background color and border

MWE from matplotlib import pyplot as plt import seaborn as sb df = sb.load_dataset("titanic") g = sb.catplot( data=df, x="who", y="survived", hue="class", ...
Gaslight Deceive Subvert's user avatar
0 votes
2 answers
34 views

2 legends on graph matplotlib [duplicate]

I want to plot a number of curves for different models. I have curves for different structures. The structures need to have the same color and the different models a different linestyle. I then want 2 ...
Loes Vandenbroucke's user avatar
0 votes
0 answers
30 views

Plotting problems in python script vs jupyter notebook

I am encountering issues with my plotting code when running it as a Python script in PyCharm. The plots overlap, and the legends are not displayed, which does not happen when I run the same code in a ...
JuanMuñoz's user avatar
1 vote
1 answer
42 views

How to add legend of plotted line in a box plot?

I have plotted a set of data in a boxplot, and I have added a line in the plot. I want to have the labels of the median and mean in the legend, and I have got it. However, I'm also trying to add the ...
lolloa's user avatar
  • 27
0 votes
0 answers
21 views

Line2D multiple colors in legend [duplicate]

I want to create a custom legend. Here, in the example, I create two lines. But for this line, which now is blue, I would like it to be in multiple colors: blue, green, and red. Here is a minimum ...
blahblah's user avatar
0 votes
0 answers
13 views

Matplotlib not changing legend labels for a plot in python package pyAT

So I am attempting to use a python interface of Accelerator Toolbox (pyAT: link here) to simulate the path of a few particles through an energy spectrometer. From this interface, I've utilized a ...
tfs563's user avatar
  • 1
0 votes
0 answers
30 views

Inserting legend in a Matplotlib/Geopandas Map

I've created a incidence map for a city, but now i need to manipulate the legend ( decrease its size, put it bellow the map/graph, insert labels). i've used a json file to plot the territory. Here's ...
gongmaodu's user avatar
1 vote
1 answer
58 views

How to make pyplot Hatches look pretty in the legend

I have a problem and struggle to find a solution, or phrase the question for a search engine. I have many python plots where i use hatches to show exclusions from constraints (so some hatches are not ...
TheMaker845's user avatar
1 vote
1 answer
64 views

Why doesn't sns.barplot legend show all values?

I have the following graph. Why does the last graph legend not contain all labels? It should contain these values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 20, 21] Code: # select only this year ...
John Doe's user avatar
  • 311
1 vote
1 answer
40 views

Legend for boxplot graph layers

I've made this boxplot graph # Tamanho do gráfico em polegadas plt.figure(figsize=(11, 6)) # Gráfico ax = sns.boxplot(x="CÓD. ESTAÇÃO", y ="FERRO", data=df_FERRO, linewidth=1.0, ...
gongmaodu's user avatar
1 vote
0 answers
57 views

Multiple columns of df show as 1 single label in legend and show how many columns are representing on matplotlib

I have a dataframe that contains temperature of 3 meteorological networks and each ones contains a certain meteorological stations, so the columns 0 to 34 are stations of 'REDMET' meteorological ...
Ferchiz4200's user avatar

15 30 50 per page
1
2 3 4 5
69