Anatomy of Matplotlib -- tutorial developed for the SciPy conference

Overview

Introduction

This tutorial is a complete re-imagining of how one should teach users the matplotlib library. Hopefully, this tutorial may serve as inspiration for future restructuring of the matplotlib documentation. Plus, I have some ideas of how to improve this tutorial.

Please fork and contribute back improvements! Feel free to use this tutorial for conferences and other opportunities for training.

The tutorial can be viewed on nbviewer:

Installation

All you need is matplotlib (v1.5 or greater) and jupyter installed. You can use your favorite Python package installer for this:

conda install matplotlib jupyter
git clone https://github.com/matplotlib/AnatomyOfMatplotlib.git
cd AnatomyOfMatplotlib
jupyter notebook

A browser window should appear and you can verify that everything works as expected by clicking on the Test Install.ipynb notebook. There, you will see a "code cell" that you can execute. Run it, and you should see a very simple line plot, indicating that all is well.

Comments
  • Updated the categorical example

    Updated the categorical example

    switched code in example to:

    data = [('apples', 2), ('oranges', 3), ('peaches', 1)]
    fruit, value = zip(*data)
    
    fig, ax = plt.subplots()
    ax.bar(fruit, value, align='center', color='gray')
    plt.show()
    
    opened by story645 7
  • Interactive example demo

    Interactive example demo

    This example is inspired from my severe usage of MATLAB overlay plotting where I plot on a figure and based on its distribution/look I do some operation in backend like moving the image to another directory etc. Hoping this example would become handy for someone like me(who moved from MATLAB plotting)
    Discussion : Twitter Link

    opened by nithinraok 6
  • Fixes #26

    Fixes #26

    • /mpl-data/sample_data/axes_grid folder appears to no longer exists as of matplotlib v2.2.2
    • added /assets folder in repo containing dependent numpy pickle, 'bivariate_normal.npy' file
    • revised load of data in AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb to reflect this change
    • tested successfully with matplotlib v2.2.2 and python v3.6.6
    opened by ggodreau 4
  • Add knot to Ugly Tie shape

    Add knot to Ugly Tie shape

    Added geometry to the Ugly Tie polygon to look like a knot.

    It remains a single polygon so color will affect both visible parts.

    At large zooms/resolutions a connection between the right side of the knot and the main tie is visible because the points on right side of the knot are not perfectly in-line with the upper right corner of the tie where the two larger parts of the shape are visible. If this becomes an issue, doing some math to find evenly dividing, aligned points near the current values would make the connecting section of the polygon zero width.

    opened by TheAtomicOption 3
  • New plotting overview

    New plotting overview

    I realize this is a bit last-minute and a big change, but I really feel like we were missing a good overview of the various plotting methods.

    I've added a new Part 2 (and renamed the other sections) to cover this: http://nbviewer.ipython.org/url/geology.beer/scipy2015/tutorial/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb

    I've tried to make a lot of nice summary images of the most commonly-used plotting methods. The "full" gallery can be very overwhelming, so it's useful to give people a condensed version. Also, these

    80% of the new Part 2 is just quickly looking those images so that people are vaguely aware of what's out there. The code to generate them is also there to serve as an example.

    The new section only goes over bar, fill_between and imshow in more detail. It's not anywhere near as long as it looks at first glance.

    opened by joferkington 3
  • Convert to new ipynb format

    Convert to new ipynb format

    The ipython notebook format has changed slightly in recent versions. Notebooks in the old format are automatically converted when they're opened with a more recent version, but I wanted to go ahead and commit the new format versions.

    Otherwise the diffs will be very difficult to read.

    I also added a .gitignore to ignore the hidden checkpoint folder IPython adds, if ipython notebook is run from the source directory.

    opened by joferkington 3
  • imshow color bar

    imshow color bar

    Hello matplotlib developers,

    I was watching the Youtube recording: Anatomy of Matplotlib from SciPy 2018, and I have a question about AnatomyOfMatplotlib/solutions/2.2-vmin_vmax_imshow_and_colorbars.py

    From line 17 to 18...

    for ax, data in zip(axes, [data1, data2, data3]): im = ax.imshow(data, vmin=0, vmax=3, interpolation='nearest')

    I am assuming data3 has bigger values, followed by data2 and data2, since data3 is multiplied by 3. Suppose if I switch the order of the list in line 17 from:

    for ax, data in zip(axes, [data1, data2, data3]):

    to:

    for ax, data in zip(axes, [data3, data2, data1]):

    So, the last im object would data1 which has a 10 by 10 array with max value of 1. Since we are giving the last im object to make the colorbar, would that mean the range color bar spans from 0 to around 1? Or does matplotlib somehow manage to look at all three plotted imshows and perceive that the maximum value amongst the three imshows is around 3?

    Thank you!

    opened by ZarulHanifah 2
  • Chapter 2 subsec colorbars example data missing

    Chapter 2 subsec colorbars example data missing

    Seems like the example data used in chapter 2 at the colorbar example is no longer supported as of py 3.1. bivariate_normal.npy is not in any folder and has apparantly been discontinued.

    opened by Nafalem231 2
  • Overhaul of Part 1

    Overhaul of Part 1

    First off, IPython/Jupyter has recently had a .ipynb format change, so these diffs are rather messy. If I'd thought about it more, I would have made that a separate commit, but I didn't realize until edits were underway.

    At any rate, I've changed Part1 rather significantly. I pruned some things out and expanded others. I'm intending to add another section detailing basic categories of plotting functions, so I removed several of the references to those in this section.

    Even after these changes, Part1 is still rather long. I might split it (particularly the part after the second exercise and before the third) into another section.

    At any rate hopefully you can see where I'm going with this. Thanks, and looking forward to teaching here in a few weeks!

    opened by joferkington 1
  • from __future__ import print_function so print works same for Python 2&3

    from __future__ import print_function so print works same for Python 2&3

    Just finished going through the notebooks with Python3 and everything worked fine except for having to manually modify all the print statements. Figured it could be made to seamlessly work with both Python 2 and 3 by simply using a from __future__ import print_function.

    opened by jarthurgross 1
  • Fix some typos, and cleared cell outputs.

    Fix some typos, and cleared cell outputs.

    Also threw out some extraneous sentences. Keep things simple and straight-forward. Resist the temptation to reveal everything at once. I will leave this up for a little bit for comment and then merge later today.

    opened by WeatherGod 0
  • Remove backend and add resolve nteract: matplotlib.use('nbagg')

    Remove backend and add resolve nteract: matplotlib.use('nbagg')

    Backend is no longer necessary IMO. Using a backend results in the following error on Jupyter.

    Javascript Error: IPython is not defined
    

    Also adding %matplotlib inline before importing matplotlib resolves the displaying of graphs.

    Should I fix them in the notebooks and send a PR?

    Thanks.

    opened by hasibzunair 8
  • make examples progressive

    make examples progressive

    In part 2, the example is too much to do at once. Rather, it would make sense to build up that example as more is taught. Perhaps a new feature for IPython notebooks would be useful (floating cells?)

    opened by WeatherGod 2
Releases(v2.0)
  • v2.0(Jul 25, 2014)

Owner
Matplotlib Developers
Matplotlib Developers
The Submission for SIMMC 2.0 Challenge 2021

The Submission for SIMMC 2.0 Challenge 2021 challenge website Requirements python 3.8.8 pytorch 1.8.1 transformers 4.8.2 apex for multi-gpu nltk Prepr

5 Jul 26, 2022
Learning nonlinear operators via DeepONet

DeepONet: Learning nonlinear operators The source code for the paper Learning nonlinear operators via DeepONet based on the universal approximation th

Lu Lu 239 Jan 02, 2023
Codes for SIGIR'22 Paper 'On-Device Next-Item Recommendation with Self-Supervised Knowledge Distillation'

OD-Rec Codes for SIGIR'22 Paper 'On-Device Next-Item Recommendation with Self-Supervised Knowledge Distillation' Paper, saved teacher models and Andro

Xin Xia 11 Nov 22, 2022
Code for Discriminative Sounding Objects Localization (NeurIPS 2020)

Discriminative Sounding Objects Localization Code for our NeurIPS 2020 paper Discriminative Sounding Objects Localization via Self-supervised Audiovis

51 Dec 11, 2022
T2F: text to face generation using Deep Learning

⭐ [NEW] ⭐ T2F - 2.0 Teaser (coming soon ...) Please note that all the faces in the above samples are generated ones. The T2F 2.0 will be using MSG-GAN

Animesh Karnewar 533 Dec 22, 2022
End-to-end machine learning project for rices detection

Basmatinet Welcome to this project folks ! Whether you like it or not this project is all about riiiiice or riz in french. It is also about Deep Learn

Béranger 47 Jun 18, 2022
Faster Convex Lipschitz Regression

Faster Convex Lipschitz Regression This reepository provides a python implementation of our Faster Convex Lipschitz Regression algorithm with GPU and

Ali Siahkamari 0 Nov 19, 2021
Arquitetura e Desenho de Software.

S203 Este é um repositório dedicado às aulas de Arquitetura e Desenho de Software, cuja sigla é "S203". E agora, José? Como não tenho muito a falar aq

Fabio 7 Oct 23, 2021
End-to-End Speech Processing Toolkit

ESPnet: end-to-end speech processing toolkit system/pytorch ver. 1.3.1 1.4.0 1.5.1 1.6.0 1.7.1 1.8.1 1.9.0 ubuntu20/python3.9/pip ubuntu20/python3.8/p

ESPnet 5.9k Jan 04, 2023
Fully Adaptive Bayesian Algorithm for Data Analysis (FABADA) is a new approach of noise reduction methods. In this repository is shown the package developed for this new method based on \citepaper.

Fully Adaptive Bayesian Algorithm for Data Analysis FABADA FABADA is a novel non-parametric noise reduction technique which arise from the point of vi

18 Oct 20, 2022
Kohei's 5th place solution for xview3 challenge

xview3-kohei-solution Usage This repository assumes that the given data set is stored in the following locations: $ ls data/input/xview3/*.csv data/in

Kohei Ozaki 2 Jan 17, 2022
Repo for the Video Person Clustering dataset, and code for the associated paper

Video Person Clustering Repo for the Video Person Clustering dataset, and code for the associated paper. This reporsitory contains the Video Person Cl

Andrew Brown 47 Nov 02, 2022
Official implementation of CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification

CrossViT This repository is the official implementation of CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification. ArXiv If

International Business Machines 168 Dec 29, 2022
Code for paper: Towards Tokenized Human Dynamics Representation

Video Tokneization Codebase for video tokenization, based on our paper Towards Tokenized Human Dynamics Representation. Prerequisites (tested under Py

Kenneth Li 20 May 31, 2022
Crowd-Kit is a powerful Python library that implements commonly-used aggregation methods for crowdsourced annotation and offers the relevant metrics and datasets

Crowd-Kit: Computational Quality Control for Crowdsourcing Documentation Crowd-Kit is a powerful Python library that implements commonly-used aggregat

Toloka 125 Dec 30, 2022
SwinIR: Image Restoration Using Swin Transformer

SwinIR: Image Restoration Using Swin Transformer This repository is the official PyTorch implementation of SwinIR: Image Restoration Using Shifted Win

Jingyun Liang 2.4k Jan 05, 2023
some classic model used to segment the medical images like CT、X-ray and so on

github_project This is a project for medical image segmentation. This project includes common medical image segmentation models such as U-net, FCN, De

2 Mar 30, 2022
AgML is a comprehensive library for agricultural machine learning

AgML is a comprehensive library for agricultural machine learning. Currently, AgML provides access to a wealth of public agricultural datasets for common agricultural deep learning tasks.

Plant AI and Biophysics Lab 1 Jul 07, 2022
Official Pytorch implementation of 6DRepNet: 6D Rotation representation for unconstrained head pose estimation.

6D Rotation Representation for Unconstrained Head Pose Estimation (Pytorch) Paper Thorsten Hempel and Ahmed A. Abdelrahman and Ayoub Al-Hamadi, "6D Ro

Thorsten Hempel 284 Dec 23, 2022
Code for "CloudAAE: Learning 6D Object Pose Regression with On-line Data Synthesis on Point Clouds" @ICRA2021

CloudAAE This is an tensorflow implementation of "CloudAAE: Learning 6D Object Pose Regression with On-line Data Synthesis on Point Clouds" Files log:

Gee 35 Nov 14, 2022