Contenido del Curso
Ultimate Visualization with Python
1. Matplotlib Introduction
2. Creating Commonly Used Plots
5. Plotting with Seaborn
Ultimate Visualization with Python
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.
Tarea
- Set the color of the lowest bars to
'darkslateblue'
. - Set the color of the middle bars to
'steelblue'
(the argument should follow thelabel
parameter). - Set the transparency of the middle bars to
0.7
(the rightmost argument). - Set the color of the top bars to
'goldenrod'
.
¿Todo estuvo claro?
Contenido del Curso
Ultimate Visualization with Python
1. Matplotlib Introduction
2. Creating Commonly Used Plots
5. Plotting with Seaborn
Ultimate Visualization with Python
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.
Tarea
- Set the color of the lowest bars to
'darkslateblue'
. - Set the color of the middle bars to
'steelblue'
(the argument should follow thelabel
parameter). - Set the transparency of the middle bars to
0.7
(the rightmost argument). - Set the color of the top bars to
'goldenrod'
.
¿Todo estuvo claro?