All Questions
864
questions
1
vote
1
answer
29
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 ...
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....
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 ...
0
votes
2
answers
36
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 ...
0
votes
0
answers
33
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 ...
1
vote
1
answer
46
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 ...
0
votes
0
answers
22
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 ...
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 ...
1
vote
1
answer
61
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 ...
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
...
1
vote
1
answer
42
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, ...
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 ...
0
votes
1
answer
76
views
How can I plot multiple legends for multiple geopandas plot layers?
I want two show both legends for both of my plot layers but it shows only just one legend. How can I fix this?
import geopandas
from shapely.geometry import Point
from shapely.geometry import Polygon
...
0
votes
1
answer
32
views
Do gca().lines and legend.get_lines() return the lines in the same order?
Do gca().lines and legend.get_lines() return the lines in the same corresponding order?
If not, is there a way to get corresponding legend lines from gca().lines?
1
vote
1
answer
181
views
How to make a legend with line and markers with different fillstyles?
I am unsure of how to reproduce the following lines/marker combination in matplotlib:
Note that the legend has both the line and the marker correctly. The best I could find in the matplotlib ...