Search icon CANCEL
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Matplotlib 2.x By Example

You're reading from  Matplotlib 2.x By Example

Product type Book
Published in Aug 2017
Publisher Packt
ISBN-13 9781788295260
Pages 334 pages
Edition 1st Edition
Languages
Authors (3):
Allen Yu Allen Yu
Profile icon Allen Yu
Claire Chung Claire Chung
Profile icon Claire Chung
Aldrin Yim Aldrin Yim
Profile icon Aldrin Yim
View More author details

Adjusting the layout


Figure layout, including the size and location of plots, directs the focus of our readers. A figure with good layout facilitates data presentation in a logical flow. It is thus important to familiarize ourselves with layout settings when plotting. Let's learn how to assign proper sizes, positions, and spacing to our plots.

Adjusting the size of the figure

Depending on where you want to put your figure, you may want to adjust the size and layout. Instead of manually stretching your image output afterward, which takes extra effort and can distort the text. You can set the height and width directly by calling pyplot.figure(figsize=()). As briefly mentioned in Chapter 2, Figure Aesthetics, the figure module contains all the plot elements. The figsize setting controls the overall size in inches and aspect ratio of the figure. This is also useful when we want to show a larger plot directly in a notebook, without having to export it in a high-resolution image.

Here is an example...

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 €14.99/month. Cancel anytime}