January 01, 2018, at 05:39 PM (0 comments)
The Pm GPlot recipe1 is now installed on OborWiki (off by default; you can enable it via the Configurator). It lets you use GPlot—a gnuplot wrapper with a simplified syntax—to create data graphics and embed them in a wikipage.
Contents
Usage
There are two forms of the markup, both fairly simple.
Inline data
First, you can put the plot data directly into the wikipage, surrounding it with (:gplot:)
/ (:gplotend:)
directives:
(:gplot:) # X Y Z 1.0 1.9 0.5 2.0 1.4 0.3 3.0 1.6 0.7 (:gplotend:) | |||||
You have requested a page or object that was not found on the server. This may be the result of a typo or broken link. Please contact the site administrator for assistance. If you are the site administrator:
|
This form of the markup is also compatible with Pastebin Embed and Gist Embed, letting you use a paste or a gist as the data source:
(:gplot:) (:pastebin-embed SeqVDSyW raw no-pre:) (:gplotend:) | |||||
You have requested a page or object that was not found on the server. This may be the result of a typo or broken link. Please contact the site administrator for assistance. If you are the site administrator:
|
(Note the raw
and no-pre
options to the (:pastebin-embed:)
directive; they are required.)
You can also specify various gplot options as arguments to the (:gplot:)
directive, like so:
(:gplot title="My cool chart" type=jpg:) # X Y Z 1.0 1.9 0.5 2.0 1.4 0.3 3.0 1.6 0.7 (:gplotend:) | |||||
You have requested a page or object that was not found on the server. This may be the result of a typo or broken link. Please contact the site administrator for assistance. If you are the site administrator:
|
(See Options, below, for details.)
External data files
The second form of the markup uses just the initial (:gplot:)
directive, and pulls data from one or more files. You specify the files using the files=
parameter, using a comma-separated list of file names:
(:gplot files=K4bdvMDF.txt,K4bdvMDF9.txt title="My extra-cool chart":) | |||||
You have requested a page or object that was not found on the server. This may be the result of a typo or broken link. Please contact the site administrator for assistance. If you are the site administrator:
|
Each of the filenames may be either the name of a file you’ve uploaded to your wiki as an attachment (note that the Attach:
markup is omitted; just the file name2 is required), or it may be a URL of a remote file, anywhere on the internet. (In the latter case, any commas in the URL must be properly escaped, i.e. replaced with “%2C
”.)
Options
The (:gplot:)
directive takes the following arguments:
Option | Value | Default |
---|---|---|
type | svg , png , or jpg | svg |
files | comma-separated list of attachment names or data file URLs | none |
font | see gplot documentation | none |
fontsize | see gplot documentation | none |
mplot | see gplot documentation | none |
onecolumn | 1 or 0 | 0 |
set | see gplot documentation | none |
splot | 1 or 0 | 0 |
tfont | see gplot documentation | none |
tfontsize | see gplot documentation | none |
title | "Chart title, enclosed in quotes" | none |
xlabel | see gplot documentation | none |
ylabel | see gplot documentation | none |
dateformat | see gplot documentation | none |
color | see gplot documentation | none |
name | see gplot documentation | none |
point | see gplot documentation | none |
pointsize | see gplot documentation | none |
style | see gplot documentation | none |
using | see gplot documentation | none |
thickness | see gplot documentation | none |
Note that any values with whitespace or special characters (such as the value of title
) must be enclosed in quotes (e.g. title="My cool chart"
). (See the gplot documentation for details on most of these options.)
Caching
By default, the gplot server caches GPlot’s output, using an md5 hash of the data and the GPlot options provided to the (:gplot:)
directive (so that the same graph need not be rendered anew with each page load). You can force the server to re-generate the graphs on a particular wikipage by appending ?pm_gplot_forceregen=1
to the page URL.
1 I haven’t posted this recipe to pmwiki.org yet, because in its current implementation, it relies on a remote server running a custom gplot-as-a-service script, and has no provision for using a local install of gnuplot/gplot. ⇑
2 And the wikigroup/page, if your wiki is configured for per-group or per-page attachments. ⇑