reox8624 downloadsRender gnuplot code blocks as plots, including plots of data files in the vault, with a button to flip each one between the plot and its source.
Plot functions and data in your notes with gnuplot. Write a gnuplot
code block and the plot appears in its place, in Reading view and Live Preview. Gnuplot is built
into the plugin, so there's nothing else to install. Desktop only.
```gnuplot
set grid
set xrange [-10:10]
plot sin(x) title "sin(x)", cos(x) title "cos(x)"
```
splot) and multiplots.To install by hand instead, download main.js, manifest.json and styles.css from the
latest release into
<your vault>/.obsidian/plugins/gnuplot-plot-preview/, then enable the plugin.
Put gnuplot commands in a code block tagged gnuplot. Every plot is drawn 1000 × 500 and scaled to
fit the note. Each block starts fresh, so variables and data don't carry over from other blocks.
The plugin chooses the output format itself, so leave out set terminal and set output.
Name a .csv, .dat or .txt file in plot or splot, relative to the note:
```gnuplot
set datafile separator comma
plot "data/results.csv" using 1:2 with linespoints title "Results"
```
../ reaches other folders of the vault..) aren't found, because Obsidian doesn't index
them.load or call aren't
supported.Add options in braces after gnuplot:
```gnuplot {caption="Figure 1: Trigonometric functions" alt="Sine and cosine curves"}
plot sin(x), cos(x)
```
| Option | What it does |
|---|---|
caption |
Text shown under the plot. |
alt |
A description read aloud by screen readers. |
Put each value in quotes. Values are plain text, not Markdown. If an option is misspelled, it's ignored and the plot still appears.
Plots follow your theme. In a dark theme, the white background disappears, axes and text take your theme's text colour, and every default line colour stays easy to tell apart. In a light theme, plots appear on a white card with their exact colours.
To always show the exact colours on a white card, turn off Follow dark themes in the plugin's settings.
| Setting | What it does |
|---|---|
| Render time limit | How long a plot may take before it's shown as an error. 3 seconds by default, from 0.5 to 60. |
| Follow dark themes | On by default. Turn off to keep every plot on a white card. |
| Debug logging | Writes render failures and data file changes to the developer console. |
| Command | What it does |
|---|---|
| Refresh data | Reads every data file again and redraws every plot. |
| Show every plot in this note | Switches every block in the note back from code to plot. |
| Restart renderer | Starts gnuplot afresh and redraws open notes. |
print, and gnuplot's warnings, appear above the plot.Plots are drawn on your device, inside Obsidian. The plugin doesn't connect to the internet and doesn't collect any data. It reads only the data files your plots name, and only from your vault, through Obsidian. It never writes files.
Plots are drawn by gnuplot. The licenses of the software built into this plugin are listed in THIRD_PARTY_NOTICES.md.
Released under the MIT License. To build or change the plugin, see DEVELOPMENT.md.