Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Plots Decoration | Plotting with Seaborn
Ultimate Visualization with Python

Plots DecorationPlots Decoration

Setting Style

First, let’s start with setting the style for the plot. seaborn has a set_style() function exactly for this purpose. We are interested in its only required parameter called style. It has several possible values, which are all different styles:

  • 'white';
  • 'dark';
  • 'whitegrid';
  • 'darkgrid';
  • 'ticks'.

Feel free to experiment with them:

Setting Palette

Another option you have is to change the colors of the plot elements in seaborn using the set_palette() function. We'll focus on its only required parameter palette. Here are a few possible palettes:

  • Circular palettes: 'hls', 'husl';
  • Perceptually uniform palettes: 'rocket', 'magma', 'mako', etc;
  • Diverging color palettes: 'RdBu', 'PRGn', etc;
  • Sequential color palettes: 'Greys', 'Blues', etc.

You can explore more of them here. Once again, feel free to experiment with different palettes:

Setting Context

There is another function in the seaborn library, set_context(). It affects such aspects as the size of the labels, lines, and other elements of the plot (the overall style is not affected).

Its most important parameter context which can either be a dictionary (dict) of parameters or a name of a preconfigured set (string type).

'notebook' is the default context, other contexts are 'paper', 'talk', and 'poster', which are essentially just versions of the notebook parameters scaled by a certain value.

Here is an example, you can try different contexts and see the difference:

You can explore more about set_context() in its documentation.

Завдання

  1. Use the correct function to set the style to 'dark'.
  2. Use the correct function to set the palette to 'rocket'.
  3. Use the correct function to set the context to 'talk'.

Все було зрозуміло?

Секція 5. Розділ 3
toggle bottom row
course content

Зміст курсу

Ultimate Visualization with Python

Plots DecorationPlots Decoration

Setting Style

First, let’s start with setting the style for the plot. seaborn has a set_style() function exactly for this purpose. We are interested in its only required parameter called style. It has several possible values, which are all different styles:

  • 'white';
  • 'dark';
  • 'whitegrid';
  • 'darkgrid';
  • 'ticks'.

Feel free to experiment with them:

Setting Palette

Another option you have is to change the colors of the plot elements in seaborn using the set_palette() function. We'll focus on its only required parameter palette. Here are a few possible palettes:

  • Circular palettes: 'hls', 'husl';
  • Perceptually uniform palettes: 'rocket', 'magma', 'mako', etc;
  • Diverging color palettes: 'RdBu', 'PRGn', etc;
  • Sequential color palettes: 'Greys', 'Blues', etc.

You can explore more of them here. Once again, feel free to experiment with different palettes:

Setting Context

There is another function in the seaborn library, set_context(). It affects such aspects as the size of the labels, lines, and other elements of the plot (the overall style is not affected).

Its most important parameter context which can either be a dictionary (dict) of parameters or a name of a preconfigured set (string type).

'notebook' is the default context, other contexts are 'paper', 'talk', and 'poster', which are essentially just versions of the notebook parameters scaled by a certain value.

Here is an example, you can try different contexts and see the difference:

You can explore more about set_context() in its documentation.

Завдання

  1. Use the correct function to set the style to 'dark'.
  2. Use the correct function to set the palette to 'rocket'.
  3. Use the correct function to set the context to 'talk'.

Все було зрозуміло?

Секція 5. Розділ 3
toggle bottom row
some-alt