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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Isaac Gerg
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')


Inline image 1

_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel
Reply | Threaded
Open this post in threaded view
|

Re: ylabels offset in box and whisker plots

Jody Klymak

On 6 Jun 2017, at 6:41, Isaac Gerg wrote:

Any idea why this is happening?


Code...
# Boxplot
plt.clf()
fig = matplotlib.pyplot.gcf()

Try to supply a self-contained minimal working example. What is happening that you don’t think should happen?

Cheers, Jody


_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel
Reply | Threaded
Open this post in threaded view
|

Re: ylabels offset in box and whisker plots

Isaac Gerg
I fixed it by adding 1 to the arange in yticks.  No idea though why i need this.

On Tue, Jun 6, 2017 at 11:58 AM, Jody Klymak <[hidden email]> wrote:

On 6 Jun 2017, at 6:41, Isaac Gerg wrote:

Any idea why this is happening?


Code...
# Boxplot
plt.clf()
fig = matplotlib.pyplot.gcf()

Try to supply a self-contained minimal working example. What is happening that you don’t think should happen?

Cheers, Jody



_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel