All Questions
58
questions
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
votes
2
answers
1k
views
How to put legend outside the plot for a for 2 column plot definition? [duplicate]
I am trying to plot the legend outside a 2 columns 5 rows, but in this MWE 2 rows example in matplotlib. Turns out the legend to "lower center" puts the space between the two plots as well, ...
1
vote
1
answer
228
views
How to customize the handles and labels for a legend
I am trying to customize the ax from matplotlib plot. Here I am using a surpyval package to fit the data and then plot it. The plot method in surpyval package does not accept arguments other than the ...
0
votes
0
answers
283
views
How to deal with long legend labels when using multiple columns
It is necessary that the legend element can occupy several columns so that the legend does not stretch. It should work at any ncol value.
If you increase the length of the word "Some Line", ...
0
votes
1
answer
212
views
How can I create a custom arrow-shaped legend key
I'm creating a plot using Matplotlib. I want the legend keys (the shapes next to the descriptive text in the legend) to be arrows similar to the ones present in the figure. I've been able to get an ...
0
votes
1
answer
291
views
Problem with handling multiple legends in subplots when you use plt.twinx()
I'm struggling to pass the list of my subplots with different scales on sides using plt.twinx() in each subplot to show all labels in a single legend box, but I get the following error:
...
0
votes
1
answer
175
views
Adjust spacing between 2 markers of same line displayed in the legend of matplotlib plot
I am plotting 2 markers of the same line using the following code and
I want to adjust the spacing between two markers in the legend.
Code : ref.
import matplotlib.pyplot as plt
from matplotlib....
0
votes
0
answers
154
views
matplolib legend elements bold: font size too big
I have a plot and would like to have some things in my legend bold. Unfortunately if I do this then the font size of the bold text is bigger than that of the rest. How can I keep the font size the ...
0
votes
1
answer
96
views
anchor two legends for the same plot in line one line
I have a plot with two legends that are not of the same height. I would like to place them such that their titles start at the same place on the y-axis. I know I could go and manually change ...
-1
votes
2
answers
40
views
Can any one help me fix this legend issue?
Can any expert help me merge the following legend?
I would like all the two legends to be merged
Can any expert help me merge the following legend?
I would like all the two legends to be merged
def ...
2
votes
1
answer
4k
views
Manually add legend entry to Seaborn Legend
I create overlaying distribution plots by group memberships using
gfg = sns.displot(hist_dat, x="Outcome", hue="Group", kind="kde", fill = True,
palette=...
0
votes
1
answer
1k
views
How to plot a barplot with different hatch and edge color with legends using matplotlib?
I would like to plot a barplot where bars have a different hatch and edge color using Matplotlib with its proper legends. I tried to plot but I couldn't generate proper legends with this code:
import ...
2
votes
2
answers
1k
views
How to change the font family of matplotlib legend AND legend title?
I would like to use the font family "Consolas" in my matplotlib legend in order to benefit the monospaced font. I also want a legend title.
But it seems that when I change the font family of ...
0
votes
0
answers
406
views
How to add a condition to legend labelling to show certain entries only
is it possible to create plot labels based on conditions? As one can see below, I am creating plots within a loop. The issue is that not all locations of the dataset contain data to plot as time ...
0
votes
0
answers
118
views
How to add a legend according to colors?
How to add a legend according to colors? I looked at this question, but I got an error about handles. What is wrong, please?
import matplotlib.pyplot as plt
import pandas as pd
fig, ax = plt.subplots(...