The following example code:
import seaborn as sns
planets = sns.load_dataset("planets")
sns.histplot(
planets, x="year", y="distance",
bins=30, discrete=(True, False), log_scale=(False, True),
)
How can I change the color palette being used here? I'd like to use something like sns.color_palette("Spectral", as_cmap=True) to show more clear contrast of different levels (the plot I really want has a larger number of histograms than this example, and it's hard to see the contrast with only blue hues)
You can use the cmap
parameter
sns.histplot(
planets, x="year", y="distance",
bins=30, discrete=(True, False), log_scale=(False, True),
cmap="Spectral", cbar=True,
)
But note that Spectral
specifically is a diverging palette and not really appropriate for count data.