Skip to main content

All Questions

Tagged with
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
2 answers
43 views

Altair chart legend for subset of data

As an exercise for learning more advanced altair, I'm trying to generate a simplified version of this chart: https://climatereanalyzer.org/clim/t2_daily/?dm_id=world. To simplify, I'm using gray for ...
519 votes
9 answers
999k views

How to change legend fontsize with matplotlib.pyplot

Simple question here: I'm trying to get the size of my legend using matplotlib.pyplot to be smaller (i.e., the text to be smaller). The code I'm using goes something like this: plot.figure() plot....
7 votes
1 answer
4k views

Replace Matplotlib legend's labels with image

I would like to use image instead of labels in the legend. For example, I draw 2 lines and show a legend : import matplotlib.pyplot as plt plt.plot([1,2],label="first_image") plt.plot([2,1],label="...
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
1 answer
53 views

Add size legend to plotly.express.scatter_mapbox

I have a visualization done using plotly.express.scatter_mapbox. It basically shows the different institutions on the Saudi Arabia map. These institutions are marked by small circles that are color ...
118 votes
6 answers
126k views

Show only certain items in legend

I currently am plotting a stacked bar graph of a large amount of taxonomic data, and only wish to show significant species in the legend (out of ~500 I wish to show ~25). Is there a simple way to do ...
0 votes
0 answers
21 views

How to keep decimal places in branca colormap using folium?

I'm using branca to create a custom color map to use in a folium map. I would like for the scale to display the decimal places from the index still, not round to a whole numbers, but I'm having a hard ...
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 ...
5 votes
1 answer
355 views

Legend obscures plot using Seaborn Objects API

I have a recurring problem with legends on many of my plots with legends. The legend often obscures part of the data. Reproducible example: import seaborn.objects as so import numpy as np import ...
2 votes
1 answer
243 views

Is there an alternate for 'palette' while plotting barplot through seaborn object Plot(); How to remove legend when plotting with so.Plot()

I am trying to learn the seaborn object Plot() interface. With the traditional sns.barplot() we could easily define color palette for the bars. import seaborn as sns df = sns.load_dataset('penguins') ...
3 votes
2 answers
163 views

How to reposition Figure legends into subfigures

I am new to this, trying to plot 2 subfigures horizontal with sample data using Matplotlib and Seaborn library in Jupyter Notebook, the 2 sub-charts come out alright, but the 2 legends overlap each ...
7 votes
2 answers
2k views

How can I customize the legend with Seaborn 0.12 objects?

The new Seaborn objects (v 0.12) are great but I struggle to deal with legend customization. Especially when using matplotlib to define subplots. My code: f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, ...
0 votes
0 answers
34 views

Dynamic positioning of checkboxes next to chart legend in Plotly Dash

I am currently creating a dashboard with Plotly Dash in Python and have a layout problem that I just couldn't fix over the last couple days: I have a bar chart with a metric, that is always shown and ...
10 votes
2 answers
19k views

Plotly: How to set up multiple subplots with grouped legends?

for each subplot I have 3 seperate line:2017 ,2018 and 2019 with 3 times "go.Scatter", each subplot represents one country (25 countries) with always these 3 years. I can use the subplot ...

15 30 50 per page
1
2 3 4 5
73