[matplotlib-devel] FW: [Matplotlib-users] Forcing the size of a figure

2011-08-15 Thread Stan West
From: Stan West [mailto:[email protected]] 
Sent: Monday, August 15, 2011 13:21

From: David Just [mailto:[email protected]] 
Sent: Friday, August 12, 2011 11:05
 
Now that I'm pre-building all my enlarged interpolated images to scroll
through,  I'm having trouble forcing the figure/FigureCanvas to be the size I
want.

I'm trying: 
fig.set_size_inches(768 / 72.0, 768 / 72.0),  but it ends up the same size as
the default plot.

If the issue is that the GUI window is not changing size, try adding
"forward=True" to the set_size_inches call. 

Developers:

As I was checking this with v. 1.0.1, I noticed that the Qt4Agg and TkAgg
backends are inconsistent in how they set the size of a figure. Here is the
Qt4Agg behavior:

>>> fig = plt.figure(figsize=[6, 4])
>>> print fig.get_size_inches()
[ 6.  3.97916667]
>>> fig.set_size_inches([6, 4], forward=True)
>>> print fig.get_size_inches()
[ 6.  3.4375]

The initial figure size isn't quite right, and the size after set_size_inches
is worse. (Is the resize ignoring the toolbar height?) Here is the TkAgg
behavior:

>>> fig = plt.figure(figsize=[6, 4])
>>> print fig.get_size_inches()
[ 6.125  4.125]
>>> fig.set_size_inches([6, 4], forward=True)
>>> print fig.get_size_inches()
[ 6.  3.6458]

Again, the initial size is off (due to the window border?), and the resized
size is incorrect (toolbar again?).

The WXAgg backend correctly sets the figure canvas to the desired size:

>>> fig = plt.figure(figsize=[6, 4])
>>> print fig.get_size_inches()
[ 6.  4.]
>>> fig.set_size_inches([6, 4], forward=True)
>>> print fig.get_size_inches()
[ 6.  4.]

I didn't check any other backends.

I didn't see any indication in the master branch that this behavior has
changed since 1.0.1. I didn't find a report for this issue on the tracker;
shall I create one?

--
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] FW: [Matplotlib-users] Forcing the size of a figure

2011-08-15 Thread Dieter Weber
Hi Stan,
this size problem sounds somewhat familiar to me. I had a serious
headache to get the interaction of wx.ScrolledWindow, wx.BoxSizer and
matplotlib.backends.backend_wxagg.FigureCanvasWxAgg right when zooming a
canvas in and out and resizing the window.

I am not sure if it will help you, but I've attached how exactly I set
up the three elements to behave as I wish. Unrelated code is stripped
from the example.

Hope that helps!

Dieter


Am Montag, den 15.08.2011, 13:30 -0400 schrieb Stan West:
> From: Stan West [mailto:[email protected]] 
> Sent: Monday, August 15, 2011 13:21
> 
> From: David Just [mailto:[email protected]] 
> Sent: Friday, August 12, 2011 11:05
>  
> 
> Now that I’m pre-building all my enlarged interpolated
> images to scroll through,  I’m having trouble forcing
> the figure/FigureCanvas to be the size I want.
> 
> I’m trying: 
> fig.set_size_inches(768 / 72.0, 768 / 72.0),  but it
> ends up the same size as the default plot.
> 
> If the issue is that the GUI window is not changing size, try
> adding "forward=True" to the set_size_inches call. 
> 
> Developers:
> 
> As I was checking this with v. 1.0.1, I noticed that the Qt4Agg and
> TkAgg backends are inconsistent in how they set the size of a figure.
> Here is the Qt4Agg behavior:
> 
> >>> fig = plt.figure(figsize=[6, 4])
> >>> print fig.get_size_inches()
> [ 6.  3.97916667]
> >>> fig.set_size_inches([6, 4], forward=True)
> >>> print fig.get_size_inches()
> [ 6.  3.4375]
> 
> The initial figure size isn't quite right, and the size after
> set_size_inches is worse. (Is the resize ignoring the toolbar height?)
> Here is the TkAgg behavior:
> 
> >>> fig = plt.figure(figsize=[6, 4])
> >>> print fig.get_size_inches()
> [ 6.125  4.125]
> >>> fig.set_size_inches([6, 4], forward=True)
> >>> print fig.get_size_inches()
> [ 6.  3.6458]
> 
> Again, the initial size is off (due to the window border?), and the
> resized size is incorrect (toolbar again?).
> 
> The WXAgg backend correctly sets the figure canvas to the desired
> size:
> 
> >>> fig = plt.figure(figsize=[6, 4])
> >>> print fig.get_size_inches()
> [ 6.  4.]
> >>> fig.set_size_inches([6, 4], forward=True)
> >>> print fig.get_size_inches()
> [ 6.  4.]
> 
> I didn't check any other backends.
> 
> I didn't see any indication in the master branch that this behavior
> has changed since 1.0.1. I didn't find a report for this issue on the
> tracker; shall I create one?
> 
> 
> --
> uberSVN's rich system and user administration capabilities and model 
> configuration take the hassle out of deploying and managing Subversion and 
> the tools developers use with it. Learn more about uberSVN and get a free 
> download at:  http://p.sf.net/sfu/wandisco-dev2dev
> ___
> Matplotlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

# -*- coding: utf-8 -*-
import wx
import matplotlib
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.figure import Figure

class PlotReport(wx.NotebookPage):
def __init__(self, *args, **kwargs):
super(PlotReport, self).__init__(*args, style=wx.VSCROLL|wx.HSCROLL, **kwargs)
self.figure = Figure()
self.scrollarea = wx.ScrolledWindow(parent=self, style=wx.VSCROLL|wx.HSCROLL)
self.canvas = FigureCanvas(parent=self.scrollarea, id=wx.ID_ANY, figure=self.figure)
self.sizer = wx.BoxSizer(orient=wx.VERTICAL)
self.sizer.Add(item=self.canvas, proportion=1, flag=wx.EXPAND|wx.ALIGN_CENTER)
self.scrollarea.SetSizer(self.sizer)
self.set_good_scrollrate()
self.Bind(wx.EVT_SIZE, self.onSize)
self.canvas.Bind(wx.EVT_CHAR, self.onPlotChar)

def set_good_scrollrate(self):
size = self.scrollarea.GetVirtualSize()
self.scrollarea.SetScrollRate(size.GetWidth()/50, size.GetHeight()/50)

# zooming in and out with Ctrl-+ and Ctrl--
def onPlotChar(self, evt):
code = evt.GetKeyCode()
if evt.ControlDown() and code < 256:
if chr(code) == '+':
size = self.canvas.GetSize()
size.Scale(1.3, 1.3)
availSize = self.scrollarea.GetSize()
minw = max(size.GetWidth(), availSize.GetWidth())
minh = max(size.GetHeight(), availSize.GetHeight())
self.canvas.SetMinSize(wx.Size(minw, minh))
self.canvas.SetMaxSi

[matplotlib-devel] make_room_for_ylabel_using_axesgrid.py example: no output

2011-08-15 Thread Eric Firing
JJ,

Thanks for your fast fix of the last problem I reported.

Now that the doc build is trying to run scripts with the __main__ 
conditional, one of the examples it is tripping over is 
make_room_for_ylabel_using_axesgrid.py.

When I try to run it on the command line or in ipython, it displays 
nothing at all.  I suspect that is related to the failure in the doc 
build, but I haven't looked into it at all.  (In the doc build it 
generates a huge traceback ending in
RuntimeError: maximum recursion depth exceeded in __instancecheck__
).

Eric

--
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] make_room_for_ylabel_using_axesgrid.py example: no output

2011-08-15 Thread Eric Firing
On 08/15/2011 12:07 PM, Eric Firing wrote:
> JJ,
>
> Thanks for your fast fix of the last problem I reported.
>
> Now that the doc build is trying to run scripts with the __main__
> conditional, one of the examples it is tripping over is
> make_room_for_ylabel_using_axesgrid.py.
>
> When I try to run it on the command line or in ipython, it displays
> nothing at all.  I suspect that is related to the failure in the doc
> build, but I haven't looked into it at all.  (In the doc build it
> generates a huge traceback ending in
> RuntimeError: maximum recursion depth exceeded in __instancecheck__
> ).

Correction: running it from the command line generates the same problem 
as is seen in the doc build and described above.

Eric

--
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Calling all Mac OSX users!

2011-08-15 Thread Benjamin Root
The mpl developers are getting very close to the long-awaited v1.1.0 release
of matplotlib.  Before we do so, we are doing some final checking of the
documentation to make sure that all critical pieces of information iss
correct and up to date.

In checking over the instructions for building and installing matplotlib on
MacOSX, I have found two separate sets of instructions.  On the install
page, there is a reference to a README.txt file in "release/osx".  This file
is there, but it seems to refer to other files that no longer exists.
Meanwhile, there is an un-referenced file in the top directory called
README.osx that seems a lot more current.

Because I do not have a Mac that I can use for development, I would like to
ask the community for help in determining the correct set of instructions
and to eliminate cruft.  I think it would also be useful to point users to
any relevant instructions for installing/building numpy on Macs.  I would
also like to make  sure we are current with information on installing on a
stock Lion install.

Please feel free to respond on this list, or better, make a branch on github
and submit pull requests to help us improve these documents.

Thanks!
Ben Root
--
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel