icyphy / ptII

Ptolemy II is an open-source software framework supporting experimentation with actor-oriented design.
https://ptolemy.eecs.berkeley.edu/ptolemyII
Other
99 stars 43 forks source link

Ptplot: Add support for labels and drawing lines #91

Open cxbrooks opened 16 years ago

cxbrooks commented 16 years ago

Note: the issue was created automatically with bugzilla2github tool

Original bug ID: BZ#160 From: @cxbrooks Reported version: 7.1.devel CC: pt-dev@chess.eecs.berkeley.edu

cxbrooks commented 16 years ago

Created attachment 15 Patches from Tom Peachey of Monash for Ptplot

Below is my email to Tom about his changes. The line format changes are fairly straightforward. The label changes should be looked at. We don't want to add yet another data field to PlotPoint and increase its size.

From: "Christopher Brooks" <cxh@ eecs.berkeley.edu> To: Tom Peachey <Tom.Peachey@ infotech.monash.edu.au> Subject: Ptplot: Re: Some mods to Kepler (Ptolemy) Cc: eal@ eecs.berkeley.edu Date: Mon, 28 Apr 2008 15:47:33 -0700

Hi Tom,

Thanks for your changes, I folded some of them in. My explanations are below.

Tom Peachey <Tom.Peachey@ infotech.monash.edu.au> writes:

I work with David Abramson's group at Monash Univ. You probably know that we are making some modifications to Kepler, in order to incorporate our Nimrod tools. As part of this I needed some additions to the plotml functionality in Ptolemy. Initially I tried to do this by extending the existing classes but this turned out to be impossible. So I needed to modify the current classes. The new code is attached in case you want to incorporate these changes.

Briefly, the mods. are as follows.

1.. I needed larger plotting points for graphs so have added a "bigdots" option to the "marks".

I added your bigdots change To see a bigdot, try: $PTII/bin/ptplot $PTII/ptolemy/plot/test/captionBigdotTest.plt

2.. Within the "dataset" element I've added attributes "markscolor", "linescolor" and "linesstyle". These enable control of the colours of the marks and the lines for a given dataset. A wider range of colours has been added; all standard java color-names are now recognised. The "linesstyle" may be "solid", "dashed", "dotted", "dotdashed" or "dotdotdashed".

I think these changes can go in. I'll add a feature request for this change.

3.. Individual plotted points can now be labelled. The "point" and "move" elements now allow a "label" attribute - just any text.

I'm not adding this change at this time. The problem is that for size and efficiency reasons, PlotPoint should not have any more fields added to it. We need to come up with a different architecture that allows us to add fields without increasing the size. I'll add a feature request for this change.

4.. There is a "caption" element that displays text at the bottom of the image.

The caption change is in.

Of course the plotml.dtd has been modified accordingly. To show what I needed I have attached an xml file that uses the new functions.

In the main I have renamed the files where modified by adding "Extended" to the name - so Plot.java became PlotExtended.java etc.

Files changed are:

Files changed are:

PlotMLApplication.java -> PlotMLApplicationExtended.java

PlotMLApplet.java -> PlotMLAppletExtended.java

PlotMLParser.java -> PlotMLParserExtended.java

PlotPoint.java -> PlotPointExtended.java

Plot.java -> PlotExtended.java

Also changed was PlotBox.java, but by this time I was fed up with the name changes and all the consequences that would follow. And I see that I have not updated the write methods in Plot. I'm not not sure of your coding conventions, so let me apologise for inadequacies there.

Tom Peachey

Attached file: TomPeacheyPtPlotPatch030508.tar.gz (application/unix-tar, 68844 bytes) Description: Patches from Tom Peachey of Monash for Ptplot

cxbrooks commented 16 years ago

Stefan Schroeder submitted a patch to add a label which also adds a string to PlotPoint.

I added a new feature to Ptplot 5.6. The point tag is extended to carry a "label".

<p x=3D"1.0" y=3D"-2.5" label=3D"interesting" />

The text is then plotted, next to the data point using a default font.

The patch is by no means polished, but it works for me. Perhaps it is of interest to others, too.

Please check it out and tell me your opinion.

PlotPoint.java gets a String field, which will increase size for all points, even if the String is not used. It might be better to have a separate hash or sparse matrix for labels? What I would do is have the first time we see a label initialize a separate data structure for labels. Then as we plot, we check to see if the data structure has been initialized and if it has, then we check for the label for a specific point.

cxbrooks commented 16 years ago

Created attachment 16 Ptplot Patch from Stefan Schroeder that adds labels

Attached file: StefanSchroederPtPlotLabelPatch.zip (application/x-zip, 29673 bytes) Description: Ptplot Patch from Stefan Schroeder that adds labels