Figure Scaling and Styling
Explore how to adjust figure sizes and plot elements using Seaborn's set_context function for different preset scales like paper or poster. Learn to apply temporary styles and customize axis spines and color palettes to create distinctive plots suited for varied presentation needs.
We'll cover the following...
Scaling plot elements
Seaborn is a rich visualization library that allows various plot customization options. One such option is a set of parameters that allows us to scale the plot elements. Using this option, we can use the same code to create plots suitable for applications requiring smaller or larger plots.
The seaborn library provides four plot contexts in different sizes. The four preset contexts are as follows:
- Paper
- Notebook
- Talk
- Poster
By default, seaborn uses the notebook style for its plot, as shown in the plot below:
We can change the preset value by specifying it in the sns.set_context() function. Let’s change it to paper style. We can observe from the plot below that the fonts and figure elements in the paper style are relatively smaller than in the notebook style:
Similarly, as shown in the code below, we set the talk context in the sns.set_context() ...