Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Colors and Transparency | Plots Customization
course content

Зміст курсу

Ultimate Visualization with Python

Colors and Transparency Colors and Transparency

Colors

When we discussed bar charts we customized the colors of the bars, setting a unique color for each separate bar. As a matter of fact, it is possible to change the color/colors for all the plots using the color keyword argument. Let’s have a look at an example:

Here we set the red color for the first line plot, while the second line plot was set to the blue color. Unlike scatter plots or bar plots (they have multiple elements), we can only set one color for the line plot, since it only has one element. Speaking of the bar charts, here is an example from the previous section:

Transparency

Another appearance parameter is alpha (transparency of the plot). Its default value is 1 (opaque), which is its maximum possible value. Basically, its possible values range from 0 to 1, where 0 makes the plot fully transparent.

Let’s modify our line plots with this parameter:

Using alpha=0.5 we made the plot for the linear function more transparent in order to focus more attention on the quadratic function plot. Modifying transparency is mostly used exactly for this purpose.

Завдання

  1. Set the color of the lowest bars to 'darkslateblue'.
  2. Set the color of the middle bars to 'steelblue' (the argument should follow the label parameter).
  3. Set the transparency of the middle bars to 0.7 (the rightmost argument).
  4. Set the color of the top bars to 'goldenrod'.

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

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

Зміст курсу

Ultimate Visualization with Python

Colors and Transparency Colors and Transparency

Colors

When we discussed bar charts we customized the colors of the bars, setting a unique color for each separate bar. As a matter of fact, it is possible to change the color/colors for all the plots using the color keyword argument. Let’s have a look at an example:

Here we set the red color for the first line plot, while the second line plot was set to the blue color. Unlike scatter plots or bar plots (they have multiple elements), we can only set one color for the line plot, since it only has one element. Speaking of the bar charts, here is an example from the previous section:

Transparency

Another appearance parameter is alpha (transparency of the plot). Its default value is 1 (opaque), which is its maximum possible value. Basically, its possible values range from 0 to 1, where 0 makes the plot fully transparent.

Let’s modify our line plots with this parameter:

Using alpha=0.5 we made the plot for the linear function more transparent in order to focus more attention on the quadratic function plot. Modifying transparency is mostly used exactly for this purpose.

Завдання

  1. Set the color of the lowest bars to 'darkslateblue'.
  2. Set the color of the middle bars to 'steelblue' (the argument should follow the label parameter).
  3. Set the transparency of the middle bars to 0.7 (the rightmost argument).
  4. Set the color of the top bars to 'goldenrod'.

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

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