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

Error in subplots sharey docs? #3145

Closed
fardal opened this issue Jun 22, 2014 · 4 comments
Closed

Error in subplots sharey docs? #3145

fardal opened this issue Jun 22, 2014 · 4 comments
Milestone

Comments

@fardal
Copy link
Contributor

fardal commented Jun 22, 2014

I'm using matplotlib version 1.3.1. I think sharey description is incorrect,
as might be guessed from swapping x-y, row-col.
http://matplotlib.org/api/pyplot_api.html?highlight=subplots#matplotlib.pyplot.subplots

Call this function with argument 'row' or 'col'.

def testdocs(setting):
    wavelength = np.array([0,2,4,6,8,10])
    flux = np.array([3.,1.5,0.5,1,2,2.5])

    #text from docs
    if (setting=='row'):
        print "each subplot row will share a Y axis."
    elif (setting=='col'):
        print """each subplot column will share a Y axis and the y tick labels 
on all but the last row will have visible set to False."""
    else:
        return

    sharex = False
    sharey = setting

    nrow = 2
    ncol = 3
    fig, axlist = plt.subplots(nrow, ncol, sharex=sharex, sharey=sharey)
    length = len(wavelength)
    for i, axrow in enumerate(axlist):
        for j, axes in enumerate(axrow):
            if (setting=='row'):
                axes.plot(wavelength*(i+1), flux*(j+1))
            else:
                axes.plot(wavelength*(j+1), flux*(i+j+1))

    xtitle = 'foo'
    ytitle = 'bar'
    fig.text(0.5, 0.04, xtitle, ha='center', va='center')
    fig.text(0.06, 0.5, ytitle, ha='center', va='center', rotation='vertical')
    plt.show()

TAC : edited to fix formatting

@tacaswell
Copy link
Member

Can you check the doc string on the master branch? I seem to recalling this being fixed recently.

@fardal
Copy link
Contributor Author

fardal commented Jun 23, 2014

doc string on master branch
https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/pyplot.py

If "row", each subplot row will share a Y axis.
If "col", each subplot column will share a Y axis and the y tick
labels on all but the last row will have visible set to False.

@tacaswell
Copy link
Member

@fardal Can you make a PR to fix the documentation?

@fardal
Copy link
Contributor Author

fardal commented Jun 24, 2014

ok done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants