I'm stuck on what is likely a simple thing. I'm using the default seaborn color palette in Matplotlib. I want to plot two lines that have the same color AND I want to define that color. I would like to use the colors that are part of the default seaborn palette, i.e. I'd like the seaborn red instead of the Matplotlib default red.
Here's my code snippet:
import pylab as plot
import seaborn
t = np.arange(0.0, 2.0, 0.01)
s = np.sin(2*np.pi*t)
plt.plot(t, s, 'r')
plt.plot(t, 2*s, 'r')
If I use the above code, I get Matplotlib's default red (as expected). Is there any "easy" way to tell it seaborn's red? If I don't define the colors, the colors will cycle through seaborn's default color cycle. Thanks!
So by setting color = 'red' , we're telling the Seaborn Objects system to change the color of the line to red. Note also that you can use any “named color” that Python recognizes.
Draw a line plot with possibility of several semantic groupings. The relationship between x and y can be shown for different subsets of the data using the hue , size , and style parameters. These parameters control what visual semantics are used to identify the different subsets.
You can customize the colors in your heatmap with the cmap parameter of the heatmap() function in seaborn. The following examples show the appearences of different sequential color palettes.
In seaborn 0.6 or later, you can call seaborn.set_color_codes()
or seaborn.set(color_codes=True)
and "r"
will be interpreted as the default seaborn red.
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