Traits & Chaco, 1d plots, constrained 2d axis

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

Traits & Chaco, 1d plots, constrained 2d axis

mbonner
Hello,

I am just getting going w/ traits and chaco and I am looking for a
little advice on how I should go about doing what I want to do...
which is to have two plots w/ correlated axes like in the
"Two Line Plots with Correlated Axes" example from
http://code.enthought.com/projects/chaco/gallery.php
(https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/line_plot1.py).
 But, I would like my correlated plot to be constrained to only zoom
in the x direction.

If I knew how things worked I would probably extend DataRange1d, give
it the range from the master plot and forward all requests etc.. from
one to the other but hard coding in the value for the y-axis... but
who knows, I have a feeling that will may not work, I have no idea
where the new bounds are actually calculated, and I really have no
idea how much of anything works, so if anybody out there would like to
lend me a hand I would greatly appreciate it...

My second problem is that this lower constrained plot essentially just
holds booleans, basically at a certain x value, some condition exists,
so I have marked that value as 0.0 while all others are Nans and dont
show up in the plot, I want to be able to zoom in on the master plot
but also zoom into the x axis on this boolean plot (if anybody has a
suggestion on how to make 1-d plots I would be very interested).  I
would also like to set the height of my individual plots, I have
tried...

plot = Plot(..., height = int(0.1*900), ...
&
plot.height = int(0.1*900)
&
plot.set_outer_bounds(1, int(0.1*900))
plott.outer_bounds = [900, int(0.1*900)]

and the height of the thing never ever changes, I am outputting
get_preferred_size and it never changes, everything I put in is
ignored... this is all before my call to configure_traits

my plots have been added to a VPlotContainer...

So again, any input will be greatly appreciated, I know the second
problem is trivial, perhaps the first one is too....

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

Re: Traits & Chaco, 1d plots, constrained 2d axis

Brad Buran
> I am just getting going w/ traits and chaco and I am looking for a
> little advice on how I should go about doing what I want to do...
> which is to have two plots w/ correlated axes like in the
> "Two Line Plots with Correlated Axes" example from
> http://code.enthought.com/projects/chaco/gallery.php
> (
> https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/line_plot1.py
> ).
>  But, I would like my correlated plot to be constrained to only zoom
> in the x direction.
>

Try changing the relevant line to this:

zoom = ZoomTool(component=plot1, tool_mode="range", axis="index", always_on=
False)

This will set the ZoomTool so it only zooms along the index (i.e. x) axis.
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev