The viewrendred3.py (VR3) plugin has a command to plot 2-dimensional data.  
It's probably not well-known and its help message doesn't work right now so 
one could only know how to use it from reading the source code. I'm working 
on fixing that. In the meantime, here's how it works.  It's very simple yet 
rather sophisticated. The algorithm is as tolerant as possible to make it 
very easy to insert the data, annotate it, and format it for readability.

The minibuffer command is *vr3-plot-2d*. It will plot one or two-column 
data in a node using matplotlib.  The simplest way to use it is to simply 
type or paste in some data:

1 1
2 4
3 9  # a comment about this point
4 16

The "basic"  attached image shows this basic plot (it can be gussied up, as 
we will see later).

The numbers are always interpreted as floating point. If there is only one 
column, VR3 supplies a first column, starting with 1. If there are two 
numbers on a line, they must be separated by whitespace (that is, any 
number of spaces and tabs).

All lines that start with legal floating point numbers are used as data 
lines.  All lines that don't are ignored.  Trailing comments as illustrated 
above are ignored, and any non-number can start a comment.  The data lines 
do not have to be in one contiguous block.  So you can include any 
non-numerical text anywhere you want and it will be ignored.  Here's an 
example:

1 1
2 4
The following point is questionable:
3 9
4 16

This is the basic capability, and there are options to enhance it.  Each 
option is in a block headed by a section name in brackets, like this:

[source]
file = temp\testdata.txt

The option names are *source*, *style*, and *labels*. The option blocks can 
appear anywhere in the body.    The *source* block tells VR3 to use data 
from the named file instead of the node's body.  Relative file names are 
relative the the user's .leo directory.

The *style* option lets you style the graph with a named matplotlib style, 
like "ggplot":

[style]
stylename = ggplot

The "example-styled" attached image shows a styled graph.  This plot has 
some labels, and I will cover them below.

One of the styles is "xkcd", which mimics the appearance of the hand-drawn 
charts that sometimes appear in xkcd comic strips.  This is not strictly 
speaking a matplotlib style, but you can use its name as the *stylename* 
anyway.  See the "example-xkcd" image for an example.

It's also possible to specify a matplotlib style file in which you can 
specify and change all kinds of things, but that requires some knowledge of 
matplotlib's style system and that would be too much to include here.  If 
you already have such a style file, you can specify it in the *style* block 
with the key *stylefile.*

The *labels* section can contain any or all of the following keys in any 
order:

[labels]
title = Test Graph
xaxis = The X axis
yaxis = The Y Axis

To sum up, VR3 gives you a command to plot typical 2-D data as easily and 
robustly as possible.  Please feel free to explore it.

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/ffc49239-18c8-4dfd-8552-6f31c50f1dden%40googlegroups.com.

Reply via email to