Plot Limits

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Plot Limits

Alexander S Behnaz
Hello All,

Is it possible to limit the zoom and panning ranges of the zoom tool and panning tool respectively?

In my application, I have a range outside of which there is guaranteed to be no data. I would like to allow the user to zoom in and pan around in that zoomed mode, but not allow them to do these operations outside of a certain data space range.

Does anyone know of any demos/functions that can demonstrate this?

Thanks.
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Plot Limits

bryce hendrix-2
On 6/23/2010 6:40 PM, Alexander S Behnaz wrote:
> Hello All,
>
> Is it possible to limit the zoom and panning ranges of the zoom tool and panning tool respectively?
>
> In my application, I have a range outside of which there is guaranteed to be no data. I would like to allow the user to zoom in and pan around in that zoomed mode, but not allow them to do these operations outside of a certain data space range.
>
> Does anyone know of any demos/functions that can demonstrate this?
>
>    

Try using the BetterZoomTool (I know, great name, huh?) instead of the
ZoomTool. The BetterZoomTool has a few attributes for controlling the
zoom limits and zoom factor (how much each step zooms).

As for the pan tool, set restrict_to_data=True.

Bryce
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Plot Limits

Peter Wang
On Wed, Jun 23, 2010 at 8:54 PM, Bryce Hendrix <[hidden email]> wrote:

> On 6/23/2010 6:40 PM, Alexander S Behnaz wrote:
>> Hello All,
>>
>> Is it possible to limit the zoom and panning ranges of the zoom tool and panning tool respectively?
>>
>> In my application, I have a range outside of which there is guaranteed to be no data. I would like to allow the user to zoom in and pan around in that zoomed mode, but not allow them to do these operations outside of a certain data space range.
>>
>> Does anyone know of any demos/functions that can demonstrate this?
>
> Try using the BetterZoomTool (I know, great name, huh?) instead of the
> ZoomTool. The BetterZoomTool has a few attributes for controlling the
> zoom limits and zoom factor (how much each step zooms).
>
> As for the pan tool, set restrict_to_data=True.

1. You need to set the domain_limits on the index and value mappers to
a tuple of (low, high).  One or both of these values can be None.
Once this is done, the ZoomTool will respect these limits and not zoom
in/out beyond those limits.
2. To make the PanTool respect the data limits, you need to set its
restrict_to_data trait to True.

-Peter
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Plot Limits

Alexander S Behnaz
In reply to this post by bryce hendrix-2
Bryce,

Thanks for the quick response. I tried your suggestion below.

obj.time_plot.tools.append(PanTool(obj.time_plot,
constrain_key="shift",restrict_to_data=True))

There was no error thrown, but the PanTool did not appear to restrict its panning. Was the restriction added more recently? I used the EPD Academic version from a few months ago. Perhaps I need to update?

Thank you.

----- Original Message -----
From: Bryce Hendrix <[hidden email]>
Date: Wednesday, June 23, 2010 9:54 pm
Subject: Re: [Enthought-Dev] Plot Limits

> On 6/23/2010 6:40 PM, Alexander S Behnaz wrote:
> > Hello All,
> >
> > Is it possible to limit the zoom and panning ranges of the zoom
> tool and panning tool respectively?
> >
> > In my application, I have a range outside of which there is
> guaranteed to be no data. I would like to allow the user to zoom
> in and pan around in that zoomed mode, but not allow them to do
> these operations outside of a certain data space range.
> >
> > Does anyone know of any demos/functions that can demonstrate this?
> >
> >    
>
> Try using the BetterZoomTool (I know, great name, huh?) instead of
> the
> ZoomTool. The BetterZoomTool has a few attributes for controlling
> the
> zoom limits and zoom factor (how much each step zooms).
>
> As for the pan tool, set restrict_to_data=True.
>
> Bryce
>
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev