Building custom color palettes

To build custom palettes, we first need to create a list and assign the colors we want to it, as follows:

my_palette = ['#4B0082', '#0000FF', '#00FF00', '#FFFF00', '#FF7F00', 
'#FF0000']
sns.set_palette(my_palette)
sns.palplot(sns.color_palette())

The output is as follows:

In the preceding screenshot, we created a new palette called my_palette with seven colors. We then set the palette to our newly created palette, which shows us what the colors look like.

Let's see how our plot looks with our new custom palette using the following command:

sns.boxplot(data=df);

The output from the preceding command should look like the following screenshot:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.181.129