Comments (4)
What version of seaborn? https://github.com/mwaskom/seaborn/blob/master/.github/CONTRIBUTING.md#reporting-bugs
from seaborn.
@KathSe1984 Maybe you want to consider sns.histplot(..., discrete=True)
? In general, histograms work with floats, and typically the last value goes into the last bin, even if theoretically it should fall just outside. For integer input, discrete=True
makes sure each value has its own bin.
Here is how sns.histplot([0, 1, 1, 1, 3, 4, 6], discrete=True)
looks like.
@mwaskom The plot shown with binwidth=1
(without discrete=True
) merges the two last bins, both with seaborn 0.13.2 as with the current dev version.
Personally, I don't know what the least-surprising implementation would be. Floats can be really pesky. And typical inputs can be integers, or floats rounded to a fixed precision.
As an example, an input of [0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1]
with binwidth=.2
. One could stretch the binwidth by an epsilon, but then the first bin would have 3 values. Or one could shorten the binwidth by an epsilon, and either create a weird extra bin, or make the last bin extra wide. Each approach looks strange in its own way.
The current dev version (as well as 0.13.2) for sns.histplot([0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1], binwidth=.2)
look like
from seaborn.
Agreed that discrete=True
is probably what you want here.
from seaborn.
I'm going to close as there's no evidence that seaborn is doing something wrong here. Thanks!
from seaborn.
Related Issues (20)
- Resolve pandas 2.2 warnings HOT 4
- location and orientation of split violins HOT 4
- Warning with pandas 2.2.0 and seaborn 0.13.1 kdeplot HOT 2
- sns.histplot does not draw correct bins when using log for y-axis. HOT 3
- Performance Issue: Seaborn Lineplot Execution Time Discrepancy with and without Timezones HOT 5
- sns.barplot(index ="index", x=" data_column1", y="data_column2") creates error due to whitespace before column name in x, y parameters HOT 1
- AttributeError: module 'numpy' has no attribute 'float'. HOT 6
- Add Color Universal Design palette HOT 2
- Palette does not support the use of defaultdict with missing values HOT 4
- `so.Hist` ignores `common_norm=True` for the `"density"` aggregate statistic
- Differences when displaying standard deviation on line and barplot HOT 1
- Subtplot size difference from matplotlib plot HOT 5
- catplot with numeric hue and hue_order: empty legend handles HOT 2
- sns.lineplot `hue`param will make wrong number of classes when it pass a field whose dtype is not `category` HOT 1
- Calling scatterplot with size and hue raises TypeError HOT 3
- HI ,we need seaborn cpp HOT 2
- Docu: Reference to root package missing in object.inv file HOT 6
- Value error in histplot with binwidth smaller than half the data range HOT 2
- UnboundLocalError: local variable 'boxprops' referenced before assignment HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seaborn.