Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
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
Mastering Matplotlib

You're reading from   Mastering Matplotlib A practical guide that takes you beyond the basics of matplotlib and gives solutions to plot complex data

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781783987542
Length 292 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Up to Speed FREE CHAPTER 2. The matplotlib Architecture 3. matplotlib APIs and Integrations 4. Event Handling and Interactive Plots 5. High-level Plotting and Data Analysis 6. Customization and Configuration 7. Deploying matplotlib in Cloud Environments 8. matplotlib and Big Data 9. Clustering for matplotlib Index

Customization


On the journey through the lands of matplotlib, one of the signposts for intermediate territories is an increased need for fine-grained control over the libraries in the ecosystem. In our case, this means being able to tweak matplotlib for particular use cases such as specialty scales or projections, complex layouts, or a custom look and feel.

Creating a custom style

The first customization topic that we will cover is that of the new style support introduced in matplotlib 1.4. In the previous notebook, we saw how to get a list of the available styles:

In [2]: print(plt.style.available)
        ['bmh', 'ggplot', 'fivethirtyeight', 'dark_background',
        'grayscale']

Now, we're going to see how we can create and use one of our own custom styles.

You can create custom styles and use them by calling style.use with the path or URL to the style sheet. Alternatively, if you save the <style-name>.mplstyle file to the ~/.matplotlib/stylelib directory (you may need to create it...

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