Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use plt.subplots() in examples as much as possible #1462

Closed
wants to merge 4 commits into from

Commits on Nov 8, 2012

  1. use plt.subplots() in examples as much as possible

    At the recent LBL Software Carpentry Workshop, it was pointed out that there's
    an inconsistency within our documentation for how to create new figures with
    subplots.
    
    Indeed, most examples were using the old way, something like:
    
        fig = plt.figure()
        ax = plt.subplot(111) # or plt.add_subplot(111)
    
    This patch changes a whole bunch of instances like the above to:
    
        fig, ax = plt.subplots()
    
    We should strive to have a minimal amount of constants in our code,
    especially unusual ones like `111`, which only make sense to Matlab
    refugees.
    
    I have left unchanged examples which were using axes keywords passed to
    subplot() and add_subplot(), since those end up transforming things like:
    
        figure()
        subplot(111, axisbg='w')
    
    to
    
        plt.subplots(subplot_kw=dict(axisbg='w'))
    
    which isn't necessarily better.
    
    I also did not touch most of the user_interfaces examples, since those did not
    involve using plt, but instead explicitly imported Figure, and used the OO
    approach on Figure instances.
    
    Also updated instaces where the old "import pylab as p" convention was used to
    use our standard "import matplotlib.pyplot as plt"
    
    I have also updated some, but not all uses of subplot(121) etc, but I'm a bit
    exhausted after doing all of these.
    ivanov committed Nov 8, 2012
    Copy the full SHA
    5c54d8f View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    e12a16e View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2012

  1. Copy the full SHA
    9a31dbb View commit details
    Browse the repository at this point in the history

Commits on Nov 12, 2012

  1. Copy the full SHA
    79df1b6 View commit details
    Browse the repository at this point in the history