Chaco : what's the best way to write text under a container of plots

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

Chaco : what's the best way to write text under a container of plots

Bruce Dayton
Hi everyone,

I'm trying to write some text under a container of plots and am having
little luck.

Can anyone telling me what the best way of writing text under a
container, or point me to an example?

My code goes like this :

#######

container = HPlotContainer(...

plotdata = ArrayPlotData()

plotdata.set_data(...

plotdata.set_data(...

plot = Plot(plotdata)

plot.plot(...

# now writing text to bottom of plot with PlotLabel, TextBoxOverlay

self.container.padding_bottom = 50
self.container.overlays.append(PlotLabel("Decay Curves",
                                            component=container,
                                            #font = "helvetica 16",
                                            overlay_position = "bottom"))

self.container.overlays.append(TextBoxOverlay(text = "Decay Curves1",
                                            component=container,
                                            #font = "helvetica 16",
                                            align = "ll"))
           
self.container.overlays.append(TextBoxOverlay(text = "Decay Curves2",
                                            component=container,
                                            #font = "helvetica 16",
                                            align = "lr"))

#####

One of the problems with this method is that the text that is written
underneath of the container of plots looks very fuzzy and seems hard to
position nicely on the plotting surface.

Can you tell me if there is a better way to put a lot of text underneath
a container of plots?

Thanks in advance!

Bruce




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

Re: Chaco : what's the best way to write text under a container of plots

Peter Wang
Hi Bruce,

Sorry it's taken a while to get back to you.  I have committed a small
fix to the plot_label.py class so that it participates in layout as a
first-class component, and doesn't have to be used as an overlay.  If
you are using an SVN check out Chaco, then please just do an "svn up".
 If not, then you can apply the following small change to your copy of
chaco/plot_label.py:
https://svn.enthought.com/enthought/changeset/25917

Once you apply this, then you can do something like the following:

    text1 = PlotLabel("Some Text", font="swiss 16")
    text2 = PlotLabel("Text2", font="Courier New 24", color="red",
                      angle=45, border_visible=True)
    cont = VPlotContainer(myplot, text1, text2, halign="center")

Note that if you omit the "halign" parameter to the VPlotContainer,
then all the labels will be left-justified in the space.

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