Default color gradient directionality in displot
See original GitHub issueThe new displot
function, when showing 2D histograms or KDE contours has its color gradient going from dark (few observations) to bright (many observations). To me this is confusing since many times the background is bright as well. In the absence of colorbar it is hard to figure out which of the bright squares has lots of observations and which has none. Consider this example (also note that the colorbar is wrong in the range of [0,1) ):
import seaborn as sns
sns.set(style="dark")
penguins = sns.load_dataset("penguins")
sns.displot(data=penguins, x="flipper_length_mm", y="culmen_length_mm", cbar=True)
Which results with: The inner brighter squares contain lost of observations, as opposed to the bright bounding squares.
For a default I think that since Axes
are filled by default with a bright color (either mpl default or seaborn-set color), it makes sense to vary colors by default from bright to dark. Also this is consistent with the way jointplot(kind="hex")
works and the 2D kdeplots from version 0.10. But if current coloring is desired, perhaps make cbar=True
the default?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Seems that ggplot does a dark-to-light ramp, and thresholds, but the low end has no saturation and the top end has more: https://ggplot2.tidyverse.org/reference/geom_bin2d.html
That would make it impossible to add a
hue
semantic (at least without changing another parameter).Just doing a simple google image search suggests that there’s an approximately even split on whether 2D histograms do or do not include 0 counts in the color mapping. (And also that too many people are still using Jet).
Also worth pointing out that the problem specifically arises with
style="dark"
, as the grid instyle="darkgrid"
will help to distinguish background from lighter extreme.