Sessions at PyCon US 2012 about matplotlib in Santa Clara Convention Center

Your current filters are…

Clear

Wednesday 7th March 2012

  • Bayesian statistics made (as) simple (as possible)

    by Allen Downey

    This tutorial is an introduction to Bayesian statistics using Python. My goal is to help participants understand the concepts and solve real problems. We will use material from my book, Think Stats: Probability and Statistics for Programmers (O’Reilly Media).

    Bayesian statistical methods are becoming more common and more important, but there are not many resources to help beginners get started. People who know Python can use their programming skills to get a head start.

    I will present simple programs that demonstrate the concepts of Bayesian statistics, and apply them to a range of example problems. Participants will work hands-on with example code and practice on example problems.

    Students should have at least basic level Python and basic statistics. If you learned about Bayes’s Theorem and probability distributions at some time, that’s enough, even if you don’t remember it! Students should be comfortable with logarithms and plotting data on a log scale.

    Students should bring a laptop with Python 2.x and matplotlib. You can work in any environment; you just need to be able to download a Python program and run it.

    Outline:

    • Bayes’s theorem.
    • Representing probability distributions.
    • Bayesian estimation.
    • Biased coins and student test scores.
    • Censored data.
    • The locomotive / German tank problem.
    • Hierarchical models and the hidden species problem.

    At 9:00am to 12:20pm, Wednesday 7th March

    In D2, Santa Clara Convention Center

    Coverage video

Thursday 8th March 2012

  • Plotting with matplotlib

    by Mike Müller

    When it comes to plotting with Python many people think about matplotlib. It is widely used and provides a simple interface for creating a wide variety of plots from very simple diagrams to sophisticated animations. This tutorial is a hands-on introduction that teaches the basics of matplotlib. Students will learn how to create publication-ready plots with just a few lines of Python.

    Target Audience

    This tutorial is for Python users who would like to create nice 2d plots with Python.

    Audience Level

    Students should have a working knowledge of Python. NumPy knowledge is helpful but not required.

    Prerequisites

    Please bring your laptop with the operating system of your choice (Linux, Mac OS X, Windows). In addition to Python 2.6 or 2.7, we need: - a current versions of matplotlib (http://matplotlib.sourceforge.net) - IPython (http://ipython.org) and - NumPy (http://numpy.scipy.org).

    Method

    This is a hands-on course. Students are strongly encouraged to work along with the trainer at the interactive prompt. There will be exercises the students need to do on their own. Experience shows that this active involvement is essential for an effective learning.

    Content

    The library matplotlib provides many different types of diagrams from within Python with only few lines of code. Examples are used to exercise the use of this library. The tutorial provides an overview how to create plots with matplotlib. IPython in combination with pylab from matplotlib provides an interactive environment for fast testing of ideas. We will be using this for most of the tutorial.

    With a simple plot we learn how to add axis labels, titles and a legend. The GUI offers zooming, panning, changing of plot sizes and other interactive ways to modify the plot. We will use Python to change properties of existing plots such as line colors, marker symbols, or line styles. There are several ways how to place text on plots. You will learn about the different coordinate systems relative to the plot, the canvas or the figure. Another topic are ticks, where to put them and how to format them to achieve publication-quality plots. The concepts of figures, subplots, and axes and how they relate to each other will be explained with examples.

    matplotlib offers many different types of plots. The tutorial introduces several of them with an example. A more advanced topic will be creating your own plot types. We will build a stacked plot type. Finally, we will create a small animation to explore the possibilities to visualize changes.

    Outline

    • Introduction (5 min)
    • IPython (5 min)
    • pylab (5 min)
    • Simple plots (20 min)
    • Properties (15 min)
    • Text (20 min)
    • Ticks (25 min)
    • Figures, subplots, and axes (25 min)
    • Other types of plots (10 min)
    • The class library (15 min)
    • Creating New Plot Types (20 min)
    • Animations (15 min)

    At 9:00am to 12:20pm, Thursday 8th March

    In H1, Santa Clara Convention Center

    Coverage video