Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Data Visualization Cookbook (Second Edition)

You're reading from   Python Data Visualization Cookbook (Second Edition) Visualize data using Python's most popular libraries

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher
ISBN-13 9781784396695
Length 302 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (11) Chapters Close

Preface 1. Preparing Your Working Environment FREE CHAPTER 2. Knowing Your Data 3. Drawing Your First Plots and Customizing Them 4. More Plots and Customizations 5. Making 3D Visualizations 6. Plotting Charts with Images and Maps 7. Using the Right Plots to Understand Data 8. More on matplotlib Gems 9. Visualizations on the Clouds with Plot.ly Index

Defining axis lengths and limits


This recipe will demonstrate a variety of useful axis properties around limits and lengths that we can configure in matplotlib.

Getting ready

For this recipe, we want to fire up IPython:

$ ipython

After this, we need to import the plotting functions right away:

from matplotlib.pylab import *

How to do it...

Start experimenting with various properties of axes. Just calling an empty axis() function will return the default values for the axis:

In [1]: axis()
Out[1]: (0.0, 1.0, 0.0, 1.0)

Note that if you are in interactive mode and are using a windowing backend, a figure with an empty axis will be displayed.

Here the values represent xmin, xmax, ymin, and ymax respectively. Similarly, we can set values for the x and y axes:

In [2]: l = [-1, 1, -10, 10]

In [3]: axis(l)
Out[3]: [-1, 1, -10, 10]

Again, if you are in an interactive mode, this will update the same figure. Furthermore, we can also update any value separately using keyword arguments (**kwargs), setting...

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 $19.99/month. Cancel anytime
Banner background image