Thomas Passin
unread,Jul 28, 2025, 11:39:36 PMJul 28Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to leo-editor
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.