Gnuplot diagram
Use two fingers to pan and zoom
Example taken here
About
Gnuplot is a graphing utility. The source code is copyrighted but freely distributed (i.e., you donβt have to pay for it). It was originally created to allow scientists and students to visualize mathematical functions and data interactively. It is also used as a plotting engine by third-party applications like Octave. Gnuplot has been supported and under active development since 1986.
Installation
-
Install dependencies
Terminal window pnpm add @beoe/rehype-gnuplot -
Configure Astro. See note about Rehype plugins for code.
astro.config.mjs import { rehypeGnuplot } from "@beoe/rehype-gnuplot";export default defineConfig({markdown: {rehypePlugins: [[rehypeGnuplot, { class: "not-content" }]],},}); -
Optional install dependency for cache
Terminal window pnpm add @beoe/cache -
Optional configure cache
astro.config.mjs import { getCache } from "@beoe/cache";const cache = await getCache();export default defineConfig({markdown: {rehypePlugins: [[rehypeGnuplot, { class: "not-content", cache }]],},}); -
Optional add pan and zoom for diagrams
Example
```gnuplotplot [-10:10] sin(x)```
Use two fingers to pan and zoom
Bonus: XKCD-style
Use two fingers to pan and zoom
Example taken here
Note: in order for example to work as SVG I changed following lines:
set term postscript eps font 'HumorSans' fontfile 'Humor-Sans.pfa' 22set output 'xkcd.eps'set terminal svg enhanced font "HumorSans,Patrick Hand,Chalkboard,Comic Sans MS,18"
You may use any font you like and load if, for example: