Large figure sizes get squashed or clipped?

I'm trying to make a 10 inch wide by 30 inch high, 72 dpi figure and
display it interactively. Matplotlib seems to squash the height for
anything over a certain size, depending on the backend:

···

---------------------------------------------------
#!/usr/bin/env python

import sys, os, matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt

print os.uname()
print sys.version
print matplotlib.__version__
print

f = plt.figure(figsize=(10,30), dpi=72)
print "figheight before show(): %f" % f.get_figheight()
plt.show()
print "figheight after show(): %f" % f.get_figheight()
--------------------------------------------------

Prints this:

==========================
('Linux', 'prime', '2.6.31-14-generic', '#48-Ubuntu SMP Fri Oct 16
14:05:01 UTC 2009', 'x86_64')
2.6.4 (r264:75706, Nov 2 2009, 14:44:17)
[GCC 4.4.1]
0.99.0

figheight before show(): 30.000000
figheight after show(): 22.027778

Tk squashes heights over 12 inches (the heights do get larger as you
request larger figures, but not as large as what you request); GTK
goes up to 11; and Qt4Agg only goes up to 7.3. WX seems to be the
only backend that will give me a 30 inch figure, but even then I have
to manually resize the window to make it fit. This happens in scripts
with pyplot, in ipython with or without -pylab, and via the matplotlib
API.

Is there some limitation on figure sizes?

There may be a limitation on window sizes in the various GUI backends. Have you tried using the non-GUI backend (agg), and now "show"ing it, but just using "savefig"?

Mike

doctorj@...16... wrote:

···

I'm trying to make a 10 inch wide by 30 inch high, 72 dpi figure and
display it interactively. Matplotlib seems to squash the height for
anything over a certain size, depending on the backend:

---------------------------------------------------
#!/usr/bin/env python

import sys, os, matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt

print os.uname()
print sys.version
print matplotlib.__version__
print

f = plt.figure(figsize=(10,30), dpi=72)
print "figheight before show(): %f" % f.get_figheight()
plt.show()
print "figheight after show(): %f" % f.get_figheight()
--------------------------------------------------

Prints this:

==========================
('Linux', 'prime', '2.6.31-14-generic', '#48-Ubuntu SMP Fri Oct 16
14:05:01 UTC 2009', 'x86_64')
2.6.4 (r264:75706, Nov 2 2009, 14:44:17)
[GCC 4.4.1]
0.99.0

figheight before show(): 30.000000
figheight after show(): 22.027778

Tk squashes heights over 12 inches (the heights do get larger as you
request larger figures, but not as large as what you request); GTK
goes up to 11; and Qt4Agg only goes up to 7.3. WX seems to be the
only backend that will give me a 30 inch figure, but even then I have
to manually resize the window to make it fit. This happens in scripts
with pyplot, in ipython with or without -pylab, and via the matplotlib
API.

Is there some limitation on figure sizes?

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Yes, I should have mentioned that; saving an image works fine. But
then if I want to display it 1:1 with figimage() or such, I can't. :frowning:
Silly GUIs, not wanting to display a window larger than my screen....

···

On Wed, Nov 25, 2009 at 9:43 AM, Michael Droettboom <mdroe@...86...> wrote:

There may be a limitation on window sizes in the various GUI backends. Have
you tried using the non-GUI backend (agg), and now "show"ing it, but just
using "savefig"?

Mike

doctorj@...16... wrote:

I'm trying to make a 10 inch wide by 30 inch high, 72 dpi figure and
display it interactively. Matplotlib seems to squash the height for
anything over a certain size, depending on the backend:

---------------------------------------------------
#!/usr/bin/env python

import sys, os, matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt

print os.uname()
print sys.version
print matplotlib.__version__
print

f = plt.figure(figsize=(10,30), dpi=72)
print "figheight before show(): %f" % f.get_figheight()
plt.show()
print "figheight after show(): %f" % f.get_figheight()
--------------------------------------------------

Prints this:

==========================
('Linux', 'prime', '2.6.31-14-generic', '#48-Ubuntu SMP Fri Oct 16
14:05:01 UTC 2009', 'x86_64')
2.6.4 (r264:75706, Nov 2 2009, 14:44:17)
[GCC 4.4.1]
0.99.0

figheight before show(): 30.000000
figheight after show(): 22.027778

Tk squashes heights over 12 inches (the heights do get larger as you
request larger figures, but not as large as what you request); GTK
goes up to 11; and Qt4Agg only goes up to 7.3. WX seems to be the
only backend that will give me a 30 inch figure, but even then I have
to manually resize the window to make it fit. This happens in scripts
with pyplot, in ipython with or without -pylab, and via the matplotlib
API.

Is there some limitation on figure sizes?

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008
30-Day trial. Simplify your report design, integration and deployment - and
focus on what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

I think the best solution to this problem is to have scroll bars in the figure window if needed. Depending on the size of the figure (in physical units), the size of the window containing the figure, and the zoom factor the scroll bars would appear or disappear. This would require some modifications to all GUI backends.

The same problem occurs in the Mac OS X backend, where the figure window size can be smaller than the requested size if the requested size is larger than the monitor size. See bug 2891502:

http://sourceforge.net/tracker/?func=detail&atid=560720&aid=2891502&group_id=80706

Any comments, opinions?

--Michiel.

···

--- On Wed, 11/25/09, doctorj@...16... <doctorj@...16...> wrote:

From: doctorj@...16... <doctorj@...16...>
Subject: Re: [Matplotlib-users] Large figure sizes get squashed or clipped?
To: "Michael Droettboom" <mdroe@...86...>
Cc: matplotlib-users@lists.sourceforge.net
Date: Wednesday, November 25, 2009, 7:43 PM
Yes, I should have mentioned that;
saving an image works fine. But
then if I want to display it 1:1 with figimage() or such, I
can't. :frowning:
Silly GUIs, not wanting to display a window larger than my
screen....

On Wed, Nov 25, 2009 at 9:43 AM, Michael Droettboom <mdroe@...86...> > wrote:
> There may be a limitation on window sizes in the
various GUI backends. Have
> you tried using the non-GUI backend (agg), and now
"show"ing it, but just
> using "savefig"?
>
> Mike
>
> doctorj@...16...
wrote:
>>
>> I'm trying to make a 10 inch wide by 30 inch high,
72 dpi figure and
>> display it interactively. Matplotlib seems to
squash the height for
>> anything over a certain size, depending on the
backend:
>>
>>
---------------------------------------------------
>> #!/usr/bin/env python
>>
>> import sys, os, matplotlib
>> matplotlib.use('TkAgg')
>> import matplotlib.pyplot as plt
>>
>> print os.uname()
>> print sys.version
>> print matplotlib.__version__
>> print
>>
>> f = plt.figure(figsize=(10,30), dpi=72)
>> print "figheight before show(): %f" %
f.get_figheight()
>> plt.show()
>> print "figheight after show(): %f" %
f.get_figheight()
>>
--------------------------------------------------
>>
>> Prints this:
>>
>> ==========================
>> ('Linux', 'prime', '2.6.31-14-generic',
'#48-Ubuntu SMP Fri Oct 16
>> 14:05:01 UTC 2009', 'x86_64')
>> 2.6.4 (r264:75706, Nov 2 2009, 14:44:17)
>> [GCC 4.4.1]
>> 0.99.0
>>
>> figheight before show(): 30.000000
>> figheight after show(): 22.027778
>> ==========================
>>
>> Tk squashes heights over 12 inches (the heights do
get larger as you
>> request larger figures, but not as large as what
you request); GTK
>> goes up to 11; and Qt4Agg only goes up to 7.3.
WX seems to be the
>> only backend that will give me a 30 inch figure,
but even then I have
>> to manually resize the window to make it fit.
This happens in scripts
>> with pyplot, in ipython with or without -pylab,
and via the matplotlib
>> API.
>>
>> Is there some limitation on figure sizes?
>>
>>
>>
------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free
Crystal Reports 2008
>> 30-Day trial. Simplify your report design,
integration and deployment - and
>> focus on what you do best, core application
coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal
Reports 2008 30-Day
trial. Simplify your report design, integration and
deployment - and focus on
what you do best, core application coding. Discover what's
new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Scrollbars seem like the only reasonable solution I can think of. Of course, this will require adding support in all the backends -- not a small undertaking.

I've filed a feature request for this here:

https://sourceforge.net/tracker/?func=detail&aid=2906107&group_id=80706&atid=560723

Maybe if we can select a developer for each backend it won't be too much work. Any takers?

Mike

···

On 11/28/2009 12:03 AM, Michiel de Hoon wrote:

I think the best solution to this problem is to have scroll bars in the figure window if needed. Depending on the size of the figure (in physical units), the size of the window containing the figure, and the zoom factor the scroll bars would appear or disappear. This would require some modifications to all GUI backends.

The same problem occurs in the Mac OS X backend, where the figure window size can be smaller than the requested size if the requested size is larger than the monitor size. See bug 2891502:

http://sourceforge.net/tracker/?func=detail&atid=560720&aid=2891502&group_id=80706

Any comments, opinions?

--Michiel.

--- On Wed, 11/25/09, doctorj@...16...<doctorj@...16...> wrote:

From: doctorj@...16...<doctorj@...16...>
Subject: Re: [Matplotlib-users] Large figure sizes get squashed or clipped?
To: "Michael Droettboom"<mdroe@...86...>
Cc: matplotlib-users@lists.sourceforge.net
Date: Wednesday, November 25, 2009, 7:43 PM
Yes, I should have mentioned that;
saving an image works fine. But
then if I want to display it 1:1 with figimage() or such, I
can't. :frowning:
  Silly GUIs, not wanting to display a window larger than my
screen....

On Wed, Nov 25, 2009 at 9:43 AM, Michael Droettboom<mdroe@...86...> >> wrote:
     

There may be a limitation on window sizes in the
       

various GUI backends. Have
     

you tried using the non-GUI backend (agg), and now
       

"show"ing it, but just
     

using "savefig"?

Mike

doctorj@...16...
       

wrote:
     

I'm trying to make a 10 inch wide by 30 inch high,
         

72 dpi figure and
     

display it interactively. Matplotlib seems to
         

squash the height for
     

anything over a certain size, depending on the
         

backend:
     

---------------------------------------------------
     

#!/usr/bin/env python

import sys, os, matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt

print os.uname()
print sys.version
print matplotlib.__version__
print

f = plt.figure(figsize=(10,30), dpi=72)
print "figheight before show(): %f" %
         

f.get_figheight()
     

plt.show()
print "figheight after show(): %f" %
         

f.get_figheight()
     

--------------------------------------------------
     

Prints this:

==========================
('Linux', 'prime', '2.6.31-14-generic',
         

'#48-Ubuntu SMP Fri Oct 16
     

14:05:01 UTC 2009', 'x86_64')
2.6.4 (r264:75706, Nov 2 2009, 14:44:17)
[GCC 4.4.1]
0.99.0

figheight before show(): 30.000000
figheight after show(): 22.027778

Tk squashes heights over 12 inches (the heights do
         

get larger as you
     

request larger figures, but not as large as what
         

you request); GTK
     

goes up to 11; and Qt4Agg only goes up to 7.3.
         

  WX seems to be the
     

only backend that will give me a 30 inch figure,
         

but even then I have
     

to manually resize the window to make it fit.
         

  This happens in scripts
     

with pyplot, in ipython with or without -pylab,
         

and via the matplotlib
     

API.

Is there some limitation on figure sizes?

------------------------------------------------------------------------------
     

Let Crystal Reports handle the reporting - Free
         

Crystal Reports 2008
     

30-Day trial. Simplify your report design,
         

integration and deployment - and
     

focus on what you do best, core application
         

coding. Discover what's new with
     

Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal
Reports 2008 30-Day
trial. Simplify your report design, integration and
deployment - and focus on
what you do best, core application coding. Discover what's
new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users