Movatterモバイル変換


[0]ホーム

URL:


Previous:, Up:Tables   [Contents][Index]


3.6 Org Plot

Org Plot can produce graphs of information stored in Org tables,either graphically or in ASCII art.

Graphical plots using Gnuplot

Org Plot can produce 2D and 3D graphs of information stored in Orgtables usingGnuplot andGnuplot mode. To see this in action, ensurethat you have both Gnuplot and Gnuplot mode installed on your system,then callC-c " g orM-x org-plot/gnuplot on thefollowing table.

#+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"| Sede      | Max cites | H-index ||-----------+-----------+---------|| Chile     |    257.72 |   21.39 || Leeds     |    165.77 |   19.68 || Sao Paolo |     71.00 |   11.50 || Stockholm |    134.19 |   14.33 || Morelia   |    257.56 |   17.67 |

Org Plot supports a range of plot types, and provides the ability to add more.For example, a radar plot can be generated like so:

#+PLOT: title:"An evaluation of plaintext document formats" transpose:yes type:radar min:0 max:4| Format            | Fine-grained-control | Initial Effort | Syntax simplicity | Editor Support | Integrations | Ease-of-referencing | Versatility ||-------------------+----------------------+----------------+-------------------+----------------+--------------+---------------------+-------------|| Word              |                    2 |              4 |                 4 |              2 |            3 |                   2 |           2 || LaTeX             |                    4 |              1 |                 1 |              3 |            2 |                   4 |           3 || Org Mode          |                    4 |              2 |               3.5 |              1 |            4 |                   4 |           4 || Markdown          |                    1 |              3 |                 3 |              4 |            3 |                   3 |           1 || Markdown + Pandoc |                  2.5 |            2.5 |               2.5 |              3 |            3 |                   3 |           2 |

Notice that Org Plot is smart enough to apply the table’s headers aslabels. Further control over the labels, type, content, andappearance of plots can be exercised through the ‘PLOT’ keywordpreceding a table. See below for a complete list of Org Plot options.For more information and examples see theOrg Plot tutorial.

Plot options

set

Specify any Gnuplot option to be set when graphing.

title

Specify the title of the plot.

ind

Specify which column of the table to use as the ‘x’ axis.

timeind

Specify which column of the table to use as the ‘x’ axis as a timevalue.

deps

Specify the columns to graph as a Lisp style list, surrounded byparentheses and separated by spaces for example ‘dep:(3 4)’ to graphthe third and fourth columns. Defaults to graphing all othercolumns aside from the ‘ind’ column.

transpose

When ‘y’, ‘yes’, or ‘t’ attempt to transpose the table data beforeplotting. Also recognizes the shorthand option ‘trans’.

type

Specify the type of the plot, by default one of ‘2d’, ‘3d’, ‘radar’, or ‘grid’.Available types can be customized withorg-plot/preset-plot-types.

with

Specify a ‘with’ option to be inserted for every column beingplotted, e.g., ‘lines’, ‘points’, ‘boxes’, ‘impulses’. Defaults to‘lines’.

file

If you want to plot to a file, specify‘"path/to/desired/output-file"’.

labels

List of labels to be used for the ‘deps’. Defaults to the columnheaders if they exist.

line

Specify an entire line to be inserted in the Gnuplot script.

map

When plotting ‘3d’ or ‘grid’ types, set this to ‘t’ to graph a flatmapping rather than a ‘3d’ slope.

min

Provides a minimum axis value that may be used by a plot type.Implicitly assumes the ‘y’ axis is being referred to. Canexplicitly provide a value for a either the ‘x’ or ‘y’ axis with‘xmin’ and ‘ymin’.

max

Provides a maximum axis value that may be used by a plot type.Implicitly assumes the ‘y’ axis is being referred to. Canexplicitly provide a value for a either the ‘x’ or ‘y’ axis with‘xmax’ and ‘ymax’.

ticks

Provides a desired number of axis ticks to display, that may be usedby a plot type. If none is given a plot type that requires tickswill useorg--plot/sensible-tick-num to try to determine a goodvalue.

timefmt

Specify format of Org mode timestamps as they will be parsed byGnuplot. Defaults to ‘%Y-%m-%d-%H:%M:%S’.

script

If you want total control, you can specify a script file—place thefile name between double-quotes—which will be used to plot.Before plotting, every instance of ‘$datafile’ in the specifiedscript will be replaced with the path to the generated data file.Note: even if you set this option, you may still want to specify theplot type, as that can impact the content of the data file.

ASCII bar plots

While point is on a column, typingC-c " a orM-x orgtbl-ascii-plot create a new column containing an ASCII-art barsplot. The plot is implemented through a regular column formula. Whenthe source column changes, the bar plot may be updated by refreshingthe table, for example typingC-u C-c *.

| Sede          | Max cites |              ||---------------+-----------+--------------|| Chile         |    257.72 | WWWWWWWWWWWW || Leeds         |    165.77 | WWWWWWWh     || Sao Paolo     |     71.00 | WWW;         || Stockholm     |    134.19 | WWWWWW:      || Morelia       |    257.56 | WWWWWWWWWWWH || Rochefourchat |      0.00 |              |#+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12)

The formula is an Elisp call.

Function:orgtbl-ascii-drawvalue min max &optional width

Draw an ASCII bar in a table.

VALUE is the value to plot.

MIN is the value displayed as an empty bar.MAXis the value filling all theWIDTH. Sources values outsidethis range are displayed as ‘too small’ or ‘too large’.

WIDTH is the number of characters of the bar plot. Itdefaults to ‘12’.


Previous:The Spreadsheet, Up:Tables   [Contents][Index]


[8]ページ先頭

©2009-2025 Movatter.jp