Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The Data Visualization Workshop

You're reading from   The Data Visualization Workshop A self-paced, practical approach to transforming your complex data into compelling, captivating graphics

Arrow left icon
Product type Paperback
Published in Jul 2020
Publisher Packt
ISBN-13 9781800568846
Length 536 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Mario Döbler Mario Döbler
Author Profile Icon Mario Döbler
Mario Döbler
Tim Großmann Tim Großmann
Author Profile Icon Tim Großmann
Tim Großmann
Arrow right icon
View More author details
Toc

Controlling Figure Aesthetics

As we mentioned previously, Matplotlib is highly customizable. But it also has the effect that it is very inconvenient, as it can take a long time to adjust all necessary parameters to get your desired visualization. In Seaborn, we can use customized themes and a high-level interface for controlling the appearance of Matplotlib figures.

The following code snippet creates a simple line plot in Matplotlib:

%matplotlib inline
import matplotlib.pyplot as plt
plt.figure()
x1 = [10, 20, 5, 40, 8]
x2 = [30, 43, 9, 7, 20]
plt.plot(x1, label='Group A')
plt.plot(x2, label='Group B')
plt.legend()
plt.show()

This is what the plot looks with Matplotlib's default parameters:

Figure 4.2: Matplotlib line plot

To switch to the Seaborn defaults, simply call the set() function:

%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
plt.figure()
x1 = [10, 20, 5, 40, 8]
x2 = [30, 43,...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime