Link the gnuplot source file in the markdown document. Make
sure to put it in the ../plots
directory.
![Some Math functions](../plots/some-math.svg 'bar')
make
will call gnuplot
and replaces
the link with the generated .svg
for the webpage. In
vim
press gf
to edit the source file
under the cursor.
Draw some math functions.
set title "Some math functions"
set xrange [-10:10]
set yrange [-5:5]
set zeroaxis
plot (x/4)**2, sin(x), 1/x
Make it look good. Edit ~/.gnuplot
and set svg
output, set font to sans-serif, set background color and color
scheme.
load '~/viridis.pal'
set terminal svg size 400,300 dynamic
set samples 1000
set lmargin at screen 0.1
set rmargin at screen 0.9
set bmargin at screen 0.1
set tmargin at screen 0.85
set xlabel font 'sans-serif,16'
set ylabel font 'sans-serif,16'
set xtics font 'sans-serif,16'
set ytics font "sans-serif,16"
set title font 'sans-serif,16'
Text always scales with the svg (in svg ‘s’ is scalable, so
it’s fine). I don’t like that, but svg works like a sandbox
within the html document, it will still scale even if I set
font-size with rem
. Send me a note if you know how
to fix this.