August 2017
Beginner to intermediate
334 pages
8h 22m
English
To control the height and width of the figure, we can of course rely on matplotlib.pyplot.figure(figsize=(WIDTH,HEIGHT)), which was first introduced in Chapter 3, Figure Layout and Annotations.
In this example, we are going to change the size of the previous histogram example to 8 inches wide and 4 inches tall:
import seaborn as snsimport matplotlib.pyplot as pltfrom scipy import stats# Note: Codes related to data preparation are skipped for brevity# Reset all previous theme settings to defaultssns.set()# Change the size to 8 inches wide and 4 inches tallfig = plt.figure(figsize=(8,4))# We are going to reuse current_bigmac that was generated earlier# Plot the histogramax = sns.distplot(current_bigmac.dollar_price) ...
Read now
Unlock full access