Here is a script that will make a 2-D plot of data in a node.  I think I 
posted about this once before.  This version has been improved and made 
more robust. The command is contained in the Leo outline in the attached 
zip file.

The data to be plotted can have either one or two columns.  If there is 
only one, it is taken to be the vertical (y) axis and a sequentially 
numbered horizontal axis is added. To discover whether the data are 
one-column or two-column, the script searches for the first line that 
starts with a number.  If that line contains a second number right after 
the first (being whitespace-separated), the data will be treated as 
two-column, otherwise as having one column.

Here is an example of one-column data:

1
4
9

16

If part of the node has been selected, only data contained in that 
selection will be plotted.  The rest of the node will still be searched for 
"[labels]" and "[style]" sections (see below) so that they will be applied 
even if only some of the data has been selected.

Any (whitespace-separated) text after the first (or second, if two-column) 
number is ignored, so you can add inline comments.  All other lines are 
ignored for the purpose of finding the data to be plotted.  The node can 
contain a section headed by the string "[labels]" and this section can 
contain axis and graph titles, like this:

[labels]
title = The Graph Title
xaxis = Time, Minutes
yaxis = pH

A MatPlotLib style or style file can be specified in  "[style]" section. 
 For example:

[style]
stylename = ggplot
#stylefile = styles.mpl

See the docstring for more details. Note that the docstring itself contains 
example data that can be plotted using this command. 




-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/leo-editor/b2d12e1a-b6c2-4350-a15c-46acb7f9c778n%40googlegroups.com.

<<attachment: plot2d.zip>>

Reply via email to