All Questions
Tagged with legend python-3.x
93
questions
1
vote
1
answer
200
views
Combine catplot legend with other legends in seaborn
I want to combine multiple plot legends with a catplot legend and place the single result in the upper right. I also want to replace the labels on both. Examples - {"avg tip":"average&...
4
votes
2
answers
6k
views
How to add a legend entry without a symbol/color into an existing legend?
I have a plot with a legend. I would like to add an entry into the legend box. This entry could be something like a fit parameter or something else descriptive of the data.
As an example, one can ...
1
vote
1
answer
82
views
Choosing elements for a legend in Python
I am using py.plot to display the upper and lower bounds of confidence intervals (shaded in between). I would like to label each pair of bounds with the item they are measuring. However, Python seems ...
6
votes
1
answer
3k
views
Centering matplotlib legend entries within incomplete/unfilled rows?
Say I'm making a plot with five items, and only have room to create a legend with 3 columns (more columns than this would be too wide), e.g.
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
...
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
1
answer
38
views
Custom colored lines in matplotlib but legend won't update
I am trying to plot lines out of a pandas dataframe, a pivot table of my data. There's 12 lines, one for each month of the year, and I don't want any duplicate colors. So I decided to set the colors ...
33
votes
3
answers
49k
views
Customizing the order of legends in plotly
I am trying to customize the order of legends while plotting stacked bar plots in plotly,python.
data = [
go.Bar(
y=df['sid'], # assign x as the dataframe column 'x'
...
0
votes
1
answer
293
views
Legend doesn't show up in Plotly Express line subplots
There are several answers for showing the legend if you're using plotly.graph_objs. I'm only using plotly_express though, and can't get the legend to show up when using several subplots.
I have the ...
2
votes
3
answers
1k
views
Python matplolib legend how to reduce distance between frame left edge and markers
As question suggests, I'm trying to reduce the distance between the left edge of the legend frame and the markers.
In figure there is the current plot. I would like to find a way to:
keeping the ...
0
votes
2
answers
149
views
How can I insert png symbol into web map legend with folium-python 3
This code is part of other big code that generate a web map with folium module:
legend_html = '''
<div style="position: fixed;
bottom: 40px; left: 50px; width: 100px; height: 110px;...
0
votes
2
answers
701
views
Matplotlib: display legend keys for lines as patches by default
For background, see the legend guide.
I want to display legend keys for Line2D objects as Patches (with the same color and label), by default. What is the cleanest way to do this? I tried using ...
1
vote
1
answer
1k
views
Plotly - clicking on legend items - how to make an initial setting?
When someone clicks on a legend item, it becomes grey, and the data disappears, for instance, here. It is possible to set that an item from a legend will be grey after opening the .HTML output and ...
0
votes
1
answer
60
views
Unable to visualize legend correctly in matplotlib
I am trying to visualize this graph with a lineplot, but the legend is not working correctly as you can see in the image below.
The problems are three:
two rectangles appear in the second and fourth ...
1
vote
1
answer
5k
views
How to change the size of legend box in Plotly?
It is my code below:
import plotly.graph_objects as go
fig = go.Figure()
for i in range(100):
fig.add_trace(go.Scatter(
x=[1,2],
y=[1,2],
name = f'{i}'*20,
...
0
votes
1
answer
608
views
GeoPandas | Legend not showing
Goal: Show legend
I've set legend=True and no difference was made.
for i in list(range(NUM_SLIDES)):
d = {'col1': ['Foo', 'Bar', 'Sue'], 'geometry': [foo[i], bar[i], sue[i]]}
gdf = gpd....