[Matplotlib-devel] ylabels offset in box and whisker plots

Isaac Gerg isaac.gerg at gergltd.com
Tue Jun 6 09:41:07 EDT 2017


Any idea why this is happening?


Code...
    # Boxplot
    plt.clf()
    fig = matplotlib.pyplot.gcf()
    fig.set_size_inches(9,16)
    plt.rc('lines', **{'marker':None})
    plt.grid(True)
    data = r.copy()/100
    data = np.log10(data)
    data[np.isinf(data)] = np.nan
    idx = np.nanmedian(data.T, axis=0).argsort()
    data = data[idx, :]
    newGenii = []
    z = []
    for k in idx:
        newGenii.append(genii[k])
    for k in range(data.shape[0]):
        tmp = data.T[:,k]
        tmp = tmp[np.isfinite(tmp)]
        z.append(tmp)
    plt.boxplot(z, notch = False, vert = False, whis=[5,95], sym='')
    plt.yticks(np.arange(data.shape[0]), newGenii, size='xx-small')
    plt.xlabel('Log10 Abundance')
    plt.title('Genus -- Box and Whisker')
    plt.savefig(os.path.join(baseDir, 'box and whisker.png'))
    plt.close('all')


[image: Inline image 1]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20170606/8431101f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: box and whisker.png
Type: image/png
Size: 1625342 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20170606/8431101f/attachment-0001.png>


More information about the Matplotlib-devel mailing list