matplotlib Plotting Cookbook
eBook - ePub

matplotlib Plotting Cookbook

  1. 222 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

matplotlib Plotting Cookbook

About this book

In Detail

matplotlib is part of the Scientific Python modules collection. matplotlib provides a large library of customizable plots and a comprehensive set of backends. It tries to make easy things easy and hard things possible. You can generate plots, add dimensions to the plots, and also make the plots interactive with just a few lines of code with matplotlib. Also, matplotlib integrates well with all common GUI modules.

This book is a head-first, hands-on journey into matplotlib, the complete and definite plotting package for Python. You will learn about the basic plots, how to customize them, and combine them to make sophisticated figures. Along with basic plots, you will also learn to make professional scientific plots.

In this book, you will start with the common figures that are offered by most plotting packages. You will learn how to add annotations, and play with styles, colors, scales, and shapes so that you can add personality and visual punch to your graphics. You will also see how to combine several graphics. With this book you will learn how to create sophisticated visualizations with simple code. Finally, you can make your plots interactive.

After reading "matplotlib Plotting Cookbook", you will be able to create the highest quality plots.

Approach

This book follows a cookbook style approach that puts orthogonal and non-redundant recipes in your hands. Rather than rehashing the user manual, the explanations expose the underlying logic behind matplotlib.

Who this book is for

If you are an engineer or scientist who wants to create great visualizations with Python, rather than yet another specialized language, this is the book for you. While there are several very competent plotting packages, matplotlib is just a Python module. Thus, if you know some Python already, you will feel at home from the first steps on. In case you are an application writer, you won't be left out since the integration of matplotlib is covered.

Trusted by 375,005 students

Access to over 1 million titles for a fair monthly price.

Study more efficiently using our study tools.

Information

Year
2014
Edition
1
eBook ISBN
9781849513265

matplotlib Plotting Cookbook


Table of Contents

matplotlib Plotting Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. First Steps
Introduction
Installing matplotlib
How to do it...
Plotting one curve
Getting ready
How to do it...
How it works...
There's more...
Using NumPy
Getting ready
How to do it...
How it works...
There's more...
Plotting multiple curves
How to do it...
How it works...
There's more...
Plotting curves from file data
How to do it...
How it works...
There's more...
Plotting points
How to do it...
How it works...
Plotting bar charts
How to do it...
How it works...
There's more...
The thickness of a bar
Horizontal bars
Plotting multiple bar charts
How to do it...
How it works...
There's more...
Plotting stacked bar charts
How to do it...
How it works...
There's more...
Plotting back-to-back bar charts
How to do it...
How it works...
Plotting pie charts
How to do it...
How it works...
Plotting histograms
How to do it...
How it works...
Plotting boxplots
How to do it...
How it works...
There's more...
Plotting triangulations
How to do it...
How it works...
2. Customizing the Color and Styles
Introduction
Defining your own colors
Getting ready
How to do it...
How it works...
Using custom colors for scatter plots
Getting ready
How to do it...
How it works...
There's more...
Using custom colors for bar charts
How to do it...
How it works...
There's more...
Using custom colors for pie charts
How to do it...
How it works...
Using custom colors for boxplots
How to do it...
How it works...
Using colormaps for scatter plots
How to do it...
How it works...
Using colormaps for bar charts
How to do it...
How it works...
Controlling a line pattern and thickness
How to do it...
How it works...
There's more...
The line style with other plot types
The line width
Controlling a fill pattern
How to do it...
How it works...
Controlling a marker's style
Getting ready
How to do it...
How it works...
There's more...
Controlling a marker's size
How to do it...
There's more...
Creating your own markers
How to do it...
How it works...
Getting more control over markers
How to do it...
How it works...
Creating your own color scheme
How to do it...
How it works...
There's more...
3. Working with Annotations
Introduction
Adding a title
How to do it...
How it works...
Using LaTeX-style notations
Getting ready
How to do it...
How it works...
Adding a label to each axis
How to do it...
How it works...
Adding text
How to do it...
How it works...
There's more...
Alignment control
Bounding box control
Adding arrows
How to do it...
How it works...
Adding a legend
How to do it...
How it works...
There's more...
Adding a grid
How to do it...
How it works...
Adding lines
How to do it...
How it works...
Adding shapes
How to do it...
How it works...
There's more...
Working with polygons
Working with path attributes
Controlling tick spacing
How to do it...
How it works...
There's more...
Controlling tick labeling
How to do it...
How it works...
There's more...
A simpler way to create bar charts with fixed labels
Advanced label generation
4. Working with Figures
Introduction
Compositing multiple figures
How to do it...
How it works...
There's more...
An alternative way to composite figures
Scaling both the axes equally
How to do it...
How it works...
Setting an axis range
How to do it...
How it works...
Setting the aspect ratio
How to do it...
How it works...
Inserting subfigures
How to do it...
How it works...
Using a logarithmic scale
How to do it...
How it works...
There's more...
Using polar coordinates
How to do it...
How it works...
There's more...
5. Working with a File Output
Introduction
Generating a PNG picture file
How to do it...
How it works...
Handling transparency
How to do it...
Rendering a figure to a PNG file with a transparent background
Making a HTML page that includes the figure
How it works...
There's more...
Controlling the output resolution
How to do it...
How it works...
There's more...
Generating PDF or SVG documents
How to do it...
How it works...
There's more...
Handling multiple-page PDF documents
How to do it...
How it works...
There's more...
6. Working with Maps
Introduction
Visualizing the content of a 2D array
How to do it...
How it works...
There's more…
Adding a colormap legend to a figure
How to do it...
How it works...
Visualizing nonuniform 2D data
How to do it...
How it works...
Visualizing ...

Table of contents

  1. matplotlib Plotting Cookbook

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access matplotlib Plotting Cookbook by Alexandre Devert in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Science General. We have over one million books available in our catalogue for you to explore.