Re: [Chaco-users] [Enthought-dev] Chaco2 newbie questions
by Peter Wang other posts by this author
Jul 9 2007 5:52AM messages near this date
Re: [Chaco-users] OverlayPlotContainer & zoom issue...
|
[Chaco-users] box-and-whisker plot suggestions?
Hi Tom,
> 1. When I naively combine LineInspect used in two_plots.py with the
> range_selection behavior in zoomed_plot/zoom_plot.py. The
> LineInspector doesn't show up. From the way the mouse moves, it looks
> like it is doing something but I don't see the lines.
> 2. Something is strange with the interaction of backbuffering and the
> right y axis. If I set it to right and resize the window horizontally
> the y axis always shows up in the same offset from the left of the
> window which puts it in the middle of the graph, if you increase the
> size of the window, and off the side of the window, if you decrease
> the size of the window. Strangely it works, however, if you maximize
> the window.
I'll look at these two and get back to you.
> 3. I have no idea from the examples how to get multiple lines on
> multiple plots. I.e. I want two vertically stacked plots that each
> have multiple lines. I see examples for each independently but I
> don't understand how to combine them.
Here are some general guidelines, let me know if they help:
1. All containers are nestable. So you can three
OverlayPlotContainers in a VPlotContainer and they will be stacked
vertically. Inside each of these OverlayPlotContainers, you can add
an arbitrary number of overlapping LinePlots.
2. If all of the plots in a given overlapping area share the same X
and Y ranges, then it's more convenient to use a Plot object instead
of an OverlayPlotContainer. Most (or all) of the examples in
examples/basic/ use Plot. For instance, in line_plot1.py, there are
two Plots in an HPlotContainer. The first one, plot1, has multiple
line plots on it. (You can think of the Plot object as sort of like
MPL's object-oriented plot interface. Thus, you can call its .plot()
method with a multiple Y values for a single X value, toggle axes on
and off, etc.)
3. If you can't or don't want to use the Plot object, then you can
create LinePlots (perhaps using the helper functions from
plot_factory.py) and place them inside OverlayPlotContainers, then
place the OverlayPlotContainers inside other plot containers.
> 4. Finally I want to get it to format as dates. It looks like there
> is some support for this but I can't find any examples.
Yes. Take a look at scales_test.py in the examples/ directory. This
is using some new ticking and labelling code that I wrote for both
"regular" axes as well as calendar axes. The key things you need
to do are:
from enthought.chaco2.scales.api import CalendarScaleSystem
from enthought.chaco2.scales_tick_generator import ScalesTickGenerator
# There is a new PlotAxis that uses scales, but it's not the default
# one yet. So, you have to import it manually:
from enthought.chaco2.scales_axis import PlotAxis
# cut-n-paste the definitions of add_default_axes() from
plot_factory.py,
# because we need it to use the PlotAxis imported above (instead of
# the one in axis.py).
#
def add_default_axes(...):
...
# create the axes; set the horizontal axis to use the calendar scale
left, bottom = add_default_axes(myplot)
bottom.tick_generator = ScalesTickGenerator(scale=CalendarScaleSystem())
-Peter
_______________________________________________
Chaco-users mailing list
Chaco-users@[...].com
https://mail.enthought.com/mailman/listinfo/chaco-users
|