Re: [matplotlib-devel] Axes.autoscale_view forces tight scaling with only images

2010-10-07 Thread Stan West
> From: Eric Firing [mailto:[email protected]] 
> Sent: Wednesday, October 06, 2010 20:53
> 
> I modified it slightly and applied to the maintenance branch.  It will 
> get merged into the trunk eventually.
> 
> Your patch as submitted was not respecting the previously-set value of 
> self._tight, hence my modification.

Thank you for the review and correction, Eric.  Your modification clarified
for me another behavior of the prior and new implementations: The argument
tight=True is retained for future autoscaling calls with tight=None, but
tight=False doesn't stick; future calls use the automatic children-based
logic.  Does the Axes._tight attribute need to have three legal values
(corresponding to tight, loose, and children-based) to yield the documented
behavior?


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mpl_toolkits mplot3d axes3d panning patch

2010-10-07 Thread braingram
Thanks for catching that! I added the changes to mouse_init and
improved the panning so it works more consistently at different 'zoom'
levels and attached an updated patch.

I tried to sort out the clipping issue you mentioned but failed to
wrap my head around how to clip the 3d data. It looks like (at least
in the svn trunk) there is no clipping of the 3d data (I tried
panning, zooming, and changing the axis limits and saw no clipping).
I'm also unsure how to make 3d subplots. I might just be too lost to
fix this one but if I make any progress I'll pass it along.

On Wed, Oct 6, 2010 at 4:57 PM, Benjamin Root  wrote:
> On Wed, Oct 6, 2010 at 3:45 PM, braingram  wrote:
>>
>> I fiddled around with the mplot3d axes3d panning today with some
>> useful results. I've never submitted a patch before so please let me
>> know if I did so incorrectly.
>>
>> On a related note, I noticed that middle mouse click+drags were not
>> triggering 'motion_notify_event' events with the mac osx backend.
>> However, when I Option(Alt) left mouse click+dragged The events were
>> being triggered. I'm not sure if this is a osx thing or something to
>> do with how the backend is passing on the event.
>>
>
> Thanks for this, but if I recall, the panning feature was disabled because
> of problems with (not) clipping the image outside the viewing area (which is
> noticeable when doing subplots).  Which backends have you tested this for?
> Note, I haven't time to test patches to mplot3d for another 2 weeks.
>
> As an additional request, the mouse_init() function should have another
> keyword argument added for pan_btn=2, and then use that to initialize
> self._pan_btn in the function.  Then, instead of checking if the button
> number is equal to 2, it should compare against self._pan_btn.
>
> Ben Root
>
>


mplot3d_panning.patch
Description: Binary data
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mpl_toolkits mplot3d axes3d panning patch

2010-10-07 Thread braingram
doh! I hate to spam the mailing list, but I didn't respond to your
other question.

I tested this out on the MacOSX and TkAgg backends (the only ones I
have available on this  machine). The MacOSX backend suffered from the
bug I mentioned earlier (no 'motion_notify_event' for click+drag
middle mouse) but the TkAgg worked fine.

On Thu, Oct 7, 2010 at 11:19 AM, braingram  wrote:
> Thanks for catching that! I added the changes to mouse_init and
> improved the panning so it works more consistently at different 'zoom'
> levels and attached an updated patch.
>
> I tried to sort out the clipping issue you mentioned but failed to
> wrap my head around how to clip the 3d data. It looks like (at least
> in the svn trunk) there is no clipping of the 3d data (I tried
> panning, zooming, and changing the axis limits and saw no clipping).
> I'm also unsure how to make 3d subplots. I might just be too lost to
> fix this one but if I make any progress I'll pass it along.
>
> On Wed, Oct 6, 2010 at 4:57 PM, Benjamin Root  wrote:
>> On Wed, Oct 6, 2010 at 3:45 PM, braingram  wrote:
>>>
>>> I fiddled around with the mplot3d axes3d panning today with some
>>> useful results. I've never submitted a patch before so please let me
>>> know if I did so incorrectly.
>>>
>>> On a related note, I noticed that middle mouse click+drags were not
>>> triggering 'motion_notify_event' events with the mac osx backend.
>>> However, when I Option(Alt) left mouse click+dragged The events were
>>> being triggered. I'm not sure if this is a osx thing or something to
>>> do with how the backend is passing on the event.
>>>
>>
>> Thanks for this, but if I recall, the panning feature was disabled because
>> of problems with (not) clipping the image outside the viewing area (which is
>> noticeable when doing subplots).  Which backends have you tested this for?
>> Note, I haven't time to test patches to mplot3d for another 2 weeks.
>>
>> As an additional request, the mouse_init() function should have another
>> keyword argument added for pan_btn=2, and then use that to initialize
>> self._pan_btn in the function.  Then, instead of checking if the button
>> number is equal to 2, it should compare against self._pan_btn.
>>
>> Ben Root
>>
>>
>

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mpl_toolkits mplot3d axes3d panning patch

2010-10-07 Thread Benjamin Root
On Thu, Oct 7, 2010 at 10:19 AM, braingram  wrote:

> Thanks for catching that! I added the changes to mouse_init and
> improved the panning so it works more consistently at different 'zoom'
> levels and attached an updated patch.
>
> I tried to sort out the clipping issue you mentioned but failed to
> wrap my head around how to clip the 3d data. It looks like (at least
> in the svn trunk) there is no clipping of the 3d data (I tried
> panning, zooming, and changing the axis limits and saw no clipping).
> I'm also unsure how to make 3d subplots. I might just be too lost to
> fix this one but if I make any progress I'll pass it along.
>
>
Ok, so you do see that the 3d image is not clipped when panning?  I believe
this is an issue with the backend's interface with mplot3d's special axes,
and it is certainly not trivial.  Until such issue is resolved, it is
probably best to continue disabling the pan feature.

By the way, subplotting 3d figures is a new feature made available in
version 1.0.  It is very easy.  While you still have to use the same import
command as before, you can now create a subplot axes of type 3d by doing:

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection='3d')

As for the issue with the MacOSX backend, you might need to file a separate
trouble ticket for that.

Thank you for helping to improve matplotlib!
Ben Root
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mpl_toolkits mplot3d axes3d panning patch

2010-10-07 Thread Benjamin Root
On Thu, Oct 7, 2010 at 12:25 PM, braingram  wrote:

> Thanks for the tips on adding 3d subplots. I tested to see if the
> points bled over into the other subplots and they do not. When I was
> referring to the points not being clipped I was talking about the the
> points falling outside of the drawn 3d axes within the subplot, not
> falling outside of the subplot.
>
> I tested the subplot clipping out with the TkAgg and MacOSX backends
> (two subplots side-by-side) with the these results:
> 1. the 3d points in one subplot do not extend into the other subplot
> (the unseen points: [2,2], [3,3], [4,4] in the left subplot do not
> appear in the right subplot)
> 2. the 3d points in a single subplot can appear outside of the drawn
> 3d axes (as seen in the right subplot)
>
> The clipping error (2 above) within a given subplot is not related to
> the panning code (the attached plot was not panned) and occurs
> whenever the axis limits are changed from their autoscaled values
> (either by set_xlim etc, by zooming, or by panning).
>
>
Right, this concurs with my observations when I was fiddling around with
mplot3d code over the summer.  I am not exactly sure exactly where the fault
lies, but it is related to the Agg backend renderer either not being told
what should be clipped out, or is not understanding the information coming
from mplot3d to know what should be clipped.  This will happen in any sort
of situation that moves the plot from the original view.

Ben Root
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Spine.set_position unexpectedly clears axis

2010-10-07 Thread Stan West
From: Andrew Straw [mailto:[email protected]] 
Sent: Thursday, September 30, 2010 11:55
 
On 09/29/2010 08:27 AM, Stan West wrote: 

I'm setting up an axes in which I configure the axis objects with my desired
tick locators and formatters and later configure the spines, setting their
bounds, visibility, and positions. I was surprised that setting the spine
position wiped my axis formatting by calling axis.cla(). Is it necessary that
the spine must clear the registered axis when its position is changed? (The
same clearing occurs in Spine.register_axis(), but in my case that occurs at
axes creation and doesn't cause me any trouble.)

Hi Stan, IIRC, it has to do with forcing the axis elements to reconnect to the
spine after it has a new transform. If you can think of a better way to do it,
please give it a try. Simply deleting that call causes problems in some cases,
such as in the demo multiple_yaxis_with_spines.py.

Thanks, Andrew. I tried using self.axis.reset_ticks() instead of
self.axis.cla() in Spine.set_position(), and it was sufficient to give the
correct results in multiple_yaxis_with_spines.py and spine_placement_demo.py.
Going further, I made the same substitution in Spine.register_axis() and
Spine.cla(), and the example plots still looked correct. (A patch is
attached.) These latter substitutions seem okay internally, eliminating
redundant executions of Axis.cla(): The only active calls to
Spine.register_axis() are in Axes._init_axis() immediately following the
instantiation of the axis objects, and the only call I found to Spine.cla() is
in Axes.cla() right after self.xaxis.cla() and self.yaxis.cla() have occurred.
Are these changes the way to go?

Along the way, I noticed that the polar and geographic axes in
projections/polar.py and geo.py have commented-out calls to
Spine.register_axis(), to avoid calling Axis.cla(). Does the patch help
improve that situation?



spines.Spine.patch
Description: Binary data
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel