In comp.soft-sys.ptolemy, [EMAIL PROTECTED] (Gabriel Chime) writes:

> Hi,
> I'm trying to decide what plotting package to use for a brand new
> project,
> and ptplot is one of the top candidates.
> 
> I have two questions:
> 1) Can I change the color of a subset of plotted points on the fly?

Basically, PlotBox has an array of Colors that is predefined.

PlotBox.setColors() allows you to a
    /** Set the point colors.  Note that the default colors have been
     *  carefully selected to maximize readability and that it is easy
     *  to use colors that result in a very ugly plot.
     *  @param colors Array of colors to use in succession for data sets.
     *  @see #getColors()
     */
    public void setColors(Color[] colors) {
        _colors = colors;
    }

See also
http://groups.yahoo.com/group/ptolemy-hackers/message/1655


> 2) On an ordinary x-y scatter plot, can I select a set of points by
> drawing a rectangle around them?
> In all the examples I've seen, drawing a rectangle was used for
> zooming.
> Instead of zooming, I want to change the color of the points within
> the rectangle and report the selected set of points back to the object
> that
> created the plot.
> Is that possible? 

Yes, it is possible.  Look at the zoom code and see how it maps
mouse clicks back to x/y coordinates.

You could also look how
ptolemy/plot/EditListener.java
works, where it is an interface that has one method

    /** Notify that data in the specified plot has been modified
     *  by a user edit action.
     *  @param source The plot containing the modified data.
     *  @param dataset The data set that has been modified.
     */
    public void editDataModified(EditablePlot source, int dataset);


EditablePlot then implements that interface and permits the user
to modify the plot data.

There is no code to do specifically what you want, but the two items
above should get you started

-Christopher

Christopher Hylands    [EMAIL PROTECTED]  University of California
Programmer/Analyst Chess/Ptolemy/GSRC         US Mail: 558 Cory Hall #1770
ph: 510.643.9841 fax:510.642.2739             Berkeley, CA 94720-1770
home: (F-Tu) 707.665.0131 (W-F) 510.655.5480  (office: 400A Cory)


----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to