You can specify a color for plots, but Seaborn will mute the color a bit during plotting. Is there a way to turn off 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)
# Show what the color should look like
sns.palplot(current_palette)
I have tried several ways of specifying the color and all available styles in Seaborn, but nothing has worked. I am using iPython notebook and Python 2.7.
Color codes can be set through the high-level seaborn style manager. Color codes can also be set through the function that sets the matplotlib color cycle. Map matplotlib color codes to the default seaborn palette. Use a different seaborn palette.
You can use the palette parameter to change the color of the lines for a multi-line line chart. Remember: in the section above about the hue parameter, I noted that you can create a multi-line lineplot by mapping a categorical variable to hue .
cmapmatplotlib colormap name or object, or list of colors, optional. The mapping from data values to color space.
Seaborn provides a function called color_palette(), which can be used to give colors to plots and adding more aesthetic value to it.
It is not using a muted color, its using an alpha/transparency value as part of the default.
Two answers referencing ways to modify matplotlib object transparency:
seaborn.distplot
allows you to pass different parameters for styling (*_kws
). Each plot function has it's own parameters and are therefor prefixed by the name of the plot. Eg. histogram has hist_kws
. [distplot Reference]
Because the histogram plot is located in matplotlib, we'd have to look at the keyword parameters we can pass. Like you already figured out, you can pass the 'alpha' keyword parameter to get rid of the transparancy of the lines. See reference for more arguments (kwargs section). [pyplot Reference]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With