From 89d7fefa50268eb3ea5aa487c398a9e963b4c50d Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Wed, 31 Jan 2024 23:29:17 +0100 Subject: gnuplot: initial notes --- src/tools/gnuplot.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/tools/gnuplot.md (limited to 'src/tools/gnuplot.md') diff --git a/src/tools/gnuplot.md b/src/tools/gnuplot.md new file mode 100644 index 0000000..0a2f50f --- /dev/null +++ b/src/tools/gnuplot.md @@ -0,0 +1,68 @@ +# gnuplot (1) + +``` +# Launch interactive shell. +gnuplot + +# Launch interactive shell. +gnuplot [opt] + opt: + -p ................ persist plot window + -c ......... run script file + -e "; .." ... run cmd(s) +``` + +## Frequently used configuration +```sh +# Plot title. +set title "the plot" + +# Labels. +set xlabel "abc" +set ylabel "def" + +# Output format, 'help set term' for all output formats. +set term svg +# Output file. +set output "out.svg" + +# Make axis logarithmic to given base. +set logscale x 2 + +# Change separator, default is whitespace. +set datafile separator "," +``` + +## Plot +```sh +# With specific style (eg lines, linespoint, boxes, steps, impulses, ..). +plot "" with + +> cat data.txt +1 1 3 +2 2 2 +3 3 1 +4 2 2 + +# Plot specific column. +plot "data.txt" using 1:2, "data.txt" using 1:3 +# Equivalent using the special file "", which re-uses the previous input file. +plot "data.txt" using 1:2, "" using 1:3 + +# Plot piped data. +plot "< head -n2 data.txt" + +# Plot with alternate title. +plot "data.txt" title "moose" +``` + +## Example: multiple data sets in on plot +```sh +{{#include gnuplot/mem_lat.plot}} +``` + +On Linux x86_64, [`mem_lat.c`](gnuplot/mem_lat.c) provides an example which can +be run as follows. +```sh +{{#include gnuplot/plot.sh:3:9}} +``` -- cgit v1.2.3