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
This repository is related to an Arabic tutorial, within the tutorial we discuss the common data structure and algorithms and their worst and best case for each, then implement the code using Python.

Data Structure and Algorithms with Python This repository is related to the Arabic tutorial here, within the tutorial we discuss the common data struc

Mohamed Ayman 33 Dec 2, 2022
Python implementation of cover trees, near-drop-in replacement for scipy.spatial.kdtree

This is a Python implementation of cover trees, a data structure for finding nearest neighbors in a general metric space (e.g., a 3D box with periodic

Patrick Varilly 28 Nov 25, 2022
Sequential model-based optimization with a `scipy.optimize` interface

Scikit-Optimize Scikit-Optimize, or skopt, is a simple and efficient library to minimize (very) expensive and noisy black-box functions. It implements

Scikit-Optimize 2.5k Jan 4, 2023
SciPy fixes and extensions

scipyx SciPy is large library used everywhere in scientific computing. That's why breaking backwards-compatibility comes as a significant cost and is

Nico Schlömer 16 Jul 17, 2022
Y. Zhang, Q. Yao, W. Dai, L. Chen. AutoSF: Searching Scoring Functions for Knowledge Graph Embedding. IEEE International Conference on Data Engineering (ICDE). 2020

AutoSF The code for our paper "AutoSF: Searching Scoring Functions for Knowledge Graph Embedding" and this paper has been accepted by ICDE2020. News:

AutoML Research 64 Dec 17, 2022
Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition

Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition

null 107 Dec 2, 2022
Woosung Choi 63 Nov 14, 2022
"Inductive Entity Representations from Text via Link Prediction" @ The Web Conference 2021

Inductive entity representations from text via link prediction This repository contains the code used for the experiments in the paper "Inductive enti

Daniel Daza 45 Jan 9, 2023
Github for the conference paper GLOD-Gaussian Likelihood OOD detector

FOOD - Fast OOD Detector Pytorch implamentation of the confernce peper FOOD arxiv link. Abstract Deep neural networks (DNNs) perform well at classifyi

null 17 Jun 19, 2022
Code for EMNLP 2021 main conference paper "Text AutoAugment: Learning Compositional Augmentation Policy for Text Classification"

Text-AutoAugment (TAA) This repository contains the code for our paper Text AutoAugment: Learning Compositional Augmentation Policy for Text Classific

LancoPKU 105 Jan 3, 2023
Abstractive opinion summarization system (SelSum) and the largest dataset of Amazon product summaries (AmaSum). EMNLP 2021 conference paper.

Learning Opinion Summarizers by Selecting Informative Reviews This repository contains the codebase and the dataset for the corresponding EMNLP 2021

Arthur Bražinskas 39 Jan 1, 2023
This repo is the code release of EMNLP 2021 conference paper "Connect-the-Dots: Bridging Semantics between Words and Definitions via Aligning Word Sense Inventories".

Connect-the-Dots: Bridging Semantics between Words and Definitions via Aligning Word Sense Inventories This repo is the code release of EMNLP 2021 con

null 12 Nov 22, 2022
Ratatoskr: Worcester Tech's conference scheduling system

Ratatoskr: Worcester Tech's conference scheduling system In Norse mythology, Ratatoskr is a squirrel who runs up and down the world tree Yggdrasil to

null 4 Dec 22, 2022
Learning the Beauty in Songs: Neural Singing Voice Beautifier; ACL 2022 (Main conference); Official code

Learning the Beauty in Songs: Neural Singing Voice Beautifier Jinglin Liu, Chengxi Li, Yi Ren, Zhiying Zhu, Zhou Zhao Zhejiang University ACL 2022 Mai

Jinglin Liu 257 Dec 30, 2022
A series of convenience functions to make basic image processing operations such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and Python.

imutils A series of convenience functions to make basic image processing functions such as translation, rotation, resizing, skeletonization, and displ

Adrian Rosebrock 4.3k Jan 8, 2023
Matplotlib Image labeller for classifying images

mpl-image-labeller Use Matplotlib to label images for classification. Works anywhere Matplotlib does - from the notebook to a standalone gui! For more

Ian Hunt-Isaak 5 Sep 24, 2022
Numerical Methods with Python, Numpy and Matplotlib

Numerical Bric-a-Brac Collections of numerical techniques with Python and standard computational packages (Numpy, SciPy, Numba, Matplotlib ...). Diffe

Vincent Bonnet 10 Dec 20, 2021
Img-process-manual - Utilize Python Numpy and Matplotlib to realize OpenCV baisc image processing function

Img-process-manual - Opencv Library basic graphic processing algorithm coding reproduction based on Numpy and Matplotlib library

Jack_Shaw 2 Dec 12, 2022
Ready-to-use code and tutorial notebooks to boost your way into few-shot image classification.

Easy Few-Shot Learning Ready-to-use code and tutorial notebooks to boost your way into few-shot image classification. This repository is made for you

Sicara 399 Jan 8, 2023