Skip to content

English title does not go well with gcf().tight_layout(), which yields bad image direction #8202

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

Closed
retsyo opened this issue Mar 6, 2017 · 5 comments

Comments

@retsyo
Copy link

retsyo commented Mar 6, 2017

I am using Python 3.4.4 |Anaconda 2.3.0 (64-bit) on win64 bits, with latest matplotlib and pyqt updated by conda install xx
for the following code, if I use unicode title in the for-loop, the images are shown with their corretced direction, i.e., the head is toward up like which is in original image. However, if I use English title, the images are upside-down: the people's head is toward earth

This can be observed for both TkAgg and Qt5Agg

#coding=utf-8
import matplotlib
#~ matplotlib.rcParams['backend'] = 'TkAgg'
matplotlib.rcParams['backend'] = 'Qt5Agg'

from pylab import *
import PIL.Image as Image

im=Image.open('Mario cosplay.jpg').convert('L')

orgsize=im.size
newsize=[int(i/4) for i in orgsize]

subplot(2,3,1)
imshow(im, cmap='gray', vmin=0, vmax=255)
title('original pic', fontsize=20);

filters=[Image.NEAREST, Image.BILINEAR, Image.BICUBIC, Image.ANTIALIAS]
filtersName=['NEAREST', 'BILINEAR', 'BICUBIC', 'ANTIALIAS']
for k in range(len(filters)):
    subplot(2,3,k+2)
    im1=im.resize(newsize, filters[k])
    imshow(im1, cmap='gray', vmin=0, vmax=255)
    title('原图的1/%i,插值法:%s' %  (4, filtersName[k]), fontsize=20)       # head up
    title('size: 1/%i,interpolation: %s' %  (4, filtersName[k]), fontsize=20)    # head down

gcf().tight_layout()

show()

chinese_headup
english_headdown

@retsyo retsyo changed the title unicode title does not go well with gcf().tight_layout(), which yields bad image orient English title does not go well with gcf().tight_layout(), which yields bad image direction Mar 6, 2017
@QuLogic
Copy link
Member

QuLogic commented Mar 6, 2017

I think this is the same issue as #8062. @NelleV @anntzer

@anntzer
Copy link
Contributor

anntzer commented Mar 6, 2017

I would guess so, but @retsyo needs to provide a reproducible example (I don't have his sample image...).

@retsyo
Copy link
Author

retsyo commented Mar 6, 2017

@anntzer
any image can reproduce this

@anntzer
Copy link
Contributor

anntzer commented Mar 6, 2017

In general, it is preferable to provide a self contained example, so that we can easily reproduce the issue. You may also check whether #8203 "solves" the issue (well, there's still not enough space and nothing we can do about it).

@QuLogic
Copy link
Member

QuLogic commented Aug 10, 2017

I'm going to close this as a duplicate of #8062.

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