Seaborn: specify the exact color

You can specify a color for the plot, but Seaborn will turn off the color a little while plotting. Is there any way to disable this behavior?

Example:

import matplotlib import seaborn as sns import numpy as np # Create some data np.random.seed(0) x = np.random.randn(100) # Set the Seaborn style sns.set_style('white') # Specify a color for plotting current_palette = matplotlib.colors.hex2color('#86b92e') # Make a plot g = sns.distplot(x, color=current_palette) 

Histogram with muted color

 # Show what the color should look like sns.palplot(current_palette) 

What the color should look like

I tried several ways to specify the color and all available styles in Seaborn, but nothing worked. I am using iPython notebook and Python 2.7.

+6
source share
2 answers

It does not use muted color, using the alpha / transparency value as part of the default value.

Two answers that cite ways to change the transparency of a matplotlib object:

+4
source

seaborn.distplot allows seaborn.distplot to pass various parameters for styling ( *_kws ). Each chart function has its own parameters and therefore has a chart name prefix. For instance. the histogram has hist_kws . [ distplot link ]

Since the histogram chart is in matplotlib, we will need to look at the parameters of the keywords that we can pass. As you already understood, you can pass the keyword parameter "alpha" to get rid of the transparency of the lines. See Link for additional arguments (kwargs section). [ link to pyplot ]

+2
source

All Articles