Setting plot limits in Chaco

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

Setting plot limits in Chaco

Kevin McClaning
Hi --

Long time lurker, first time poster with moderate Python experience
here. Total time with Chaco about 4 weeks on and off.

I've spent several hours searching the documentation and haven't yet
found an answer that I'm comfortable with.

I'm looking for the equivalent of matlab's xlim and ylim commands to set
the range of a Chaco scatter plot, regardless of the range of the data.
More specifically, I'd like to modify the scatter.py to scatter plot
data whose x and y values are all between 0.0 to 1.0 on a plot whose
x-axis runs from say, -2.0 to +12.0 and whose y-axis runs from say, -1.0
to +2.0. In matlab-speak:

x_data = linspace(0,6.28,100);
y_data = sin(x_data);
plot( x_data,y_data )
xlim([-2 12])
ylim([-1 2])

I found the plot.index_range and plot.value_range objects but don't have
a clear understanding of how they interact.

Thanks.

Kevin


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

Re: Setting plot limits in Chaco

Tim Diller
Kevin,
Welcome out of the shadows and into the light. ;-)
 I think what you're looking for can be found in the following plot attributes:
plot.range2d.x_range.low
plot.range2d.x_range.high
plot.range2d.y_range.low
plot.range2d.y_range.high
These can, of course, be hooked up to other Traits, etc. or set statically when you create your plot instance.
regards,
-Tim

- - -
Tim Diller, Ph. D.
Scientific Software Developer
Enthought, Inc.
(512) 536-1057x258 office
(512) 436-3455 mobile

On F 7 Dec, 2012, at 7:26 AM, Kevin McClaning wrote:

Hi --

Long time lurker, first time poster with moderate Python experience
here. Total time with Chaco about 4 weeks on and off.

I've spent several hours searching the documentation and haven't yet
found an answer that I'm comfortable with.

I'm looking for the equivalent of matlab's xlim and ylim commands to set
the range of a Chaco scatter plot, regardless of the range of the data.
More specifically, I'd like to modify the scatter.py to scatter plot
data whose x and y values are all between 0.0 to 1.0 on a plot whose
x-axis runs from say, -2.0 to +12.0 and whose y-axis runs from say, -1.0
to +2.0. In matlab-speak:

x_data = linspace(0,6.28,100);
y_data = sin(x_data);
plot( x_data,y_data )
xlim([-2 12])
ylim([-1 2])

I found the plot.index_range and plot.value_range objects but don't have
a clear understanding of how they interact.

Thanks.

Kevin


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev