Too many decimal places in legend labs for relplot with hue or size keywords
See original GitHub issueI ran into this problem with a particular dataset. Calling replot
with either hue
or size
causes extremely long labels in the legend because of what looks like floating point arithmetic in the labeling logic.
Example:
test = pd.DataFrame({
'foo' :[1,2,3,4,5,6,7],
'bar' :[4,6,8,3,5,4,6],
'baz':[0.4, 0.19, 0.35, 0.22, 0.35, 0.31, 0.09]
}
)
sns.relplot(
data=test.head(7),
x='foo',
y='bar',
size='baz')
Is there some way that the legend labels could be rounded or otherwise formatted to prevent this?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Legend In Seaborn Scatter Plot: How To Limit The Number Of ...
To make a legend for lines which already exist on the Axes (via plot for instance), ... Too many decimal places in legend...
Read more >How to get rid of decimal point in the legend - Stack Overflow
I wanted to know how I could get rid of the decimals in the legend. So instead of 1.0 it will be just...
Read more >seaborn.relplot — seaborn 0.12.1 documentation - PyData |
If “brief”, numeric hue and size variables will be represented with a sample of evenly spaced values. If “full”, every group will get...
Read more >Statistics and Machine Learning in Python - Archive ouverte HAL
Like lists, but their size cannot change: ordered, iterable, immutable, can contain multiple data types. # create a tuple digits = (0, 1 ......
Read more >Stack Overflow Answers by Trenton McKinney
CreationDate ViewCount Score Accepted
0 2021‑12‑16 44 0 True
1 2021‑12‑13 67 1 True
2 2021‑12‑09 7636 0 False
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Workaround for anyone else who finds themselves looking at this:
The specific example at the beginning of this thread now produces the expected result, so if you are having a problem in some other context, you need to provide a reproducible example that demonstrates it.