diff --git a/guide/guide-1.svg b/guide/guide-1.svg index 9c41179..c68c561 100644 --- a/guide/guide-1.svg +++ b/guide/guide-1.svg @@ -335,19 +335,107 @@ gnuplot_plot_1 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/guide/guide-2.svg b/guide/guide-2.svg new file mode 100644 index 0000000..b0c1163 --- /dev/null +++ b/guide/guide-2.svg @@ -0,0 +1,556 @@ + + + +Gnuplot +Produced by GNUPLOT 5.4 patchlevel 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1 + + + + + + + + + + + + + -0.8 + + + + + + + + + + + + + -0.6 + + + + + + + + + + + + + -0.4 + + + + + + + + + + + + + -0.2 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + 0.2 + + + + + + + + + + + + + 0.4 + + + + + + + + + + + + + 0.6 + + + + + + + + + + + + + 0.8 + + + + + + + + + + + + + 1 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + 10 + + + + + + + + + + + + + 20 + + + + + + + + + + + + + 30 + + + + + + + + + + + + + 40 + + + + + + + + + + + + + 50 + + + + + + + + + + + + + 60 + + + + + + + + + + + + + 70 + + + + + + + + + + + + + 80 + + + + + + + + + + + + + 90 + + + + + + + + + + + + + 100 + + + + + + + + + gnuplot_plot_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gnuplot_plot_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/guide/guide-3.svg b/guide/guide-3.svg new file mode 100644 index 0000000..e1ff6e5 --- /dev/null +++ b/guide/guide-3.svg @@ -0,0 +1,476 @@ + + + +Gnuplot +Produced by GNUPLOT 5.4 patchlevel 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1 + + + + + + + + + + + + + -0.8 + + + + + + + + + + + + + -0.6 + + + + + + + + + + + + + -0.4 + + + + + + + + + + + + + -0.2 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + 0.2 + + + + + + + + + + + + + 0.4 + + + + + + + + + + + + + 0.6 + + + + + + + + + + + + + 0.8 + + + + + + + + + + + + + 1 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + 10 + + + + + + + + + + + + + 20 + + + + + + + + + + + + + 30 + + + + + + + + + + + + + 40 + + + + + + + + + + + + + 50 + + + + + + + + + + + + + 60 + + + + + + + + + + + + + 70 + + + + + + + + + + + + + 80 + + + + + + + + + + + + + 90 + + + + + + + + + + + + + 100 + + + + + + + + + gnuplot_plot_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gnuplot_plot_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/guide/guide-4.svg b/guide/guide-4.svg new file mode 100644 index 0000000..b45d2be --- /dev/null +++ b/guide/guide-4.svg @@ -0,0 +1,452 @@ + + + +Gnuplot +Produced by GNUPLOT 5.4 patchlevel 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1 + + + + + + + + + + + + + -0.8 + + + + + + + + + + + + + -0.6 + + + + + + + + + + + + + -0.4 + + + + + + + + + + + + + -0.2 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + 0.2 + + + + + + + + + + + + + 0.4 + + + + + + + + + + + + + 0.6 + + + + + + + + + + + + + 0.8 + + + + + + + + + + + + + 1 + + + + + + + + + + + + + -1 + + + + + + + + + + + + + -0.8 + + + + + + + + + + + + + -0.6 + + + + + + + + + + + + + -0.4 + + + + + + + + + + + + + -0.2 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + 0.2 + + + + + + + + + + + + + 0.4 + + + + + + + + + + + + + 0.6 + + + + + + + + + + + + + 0.8 + + + + + + + + + + + + + 1 + + + + + + + + + gnuplot_plot_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/guide/guide-5.svg b/guide/guide-5.svg new file mode 100644 index 0000000..185b470 --- /dev/null +++ b/guide/guide-5.svg @@ -0,0 +1,452 @@ + + + +Gnuplot +Produced by GNUPLOT 5.4 patchlevel 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1 + + + + + + + + + + + + + -0.8 + + + + + + + + + + + + + -0.6 + + + + + + + + + + + + + -0.4 + + + + + + + + + + + + + -0.2 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + 0.2 + + + + + + + + + + + + + 0.4 + + + + + + + + + + + + + 0.6 + + + + + + + + + + + + + 0.8 + + + + + + + + + + + + + 1 + + + + + + + + + + + + + -1 + + + + + + + + + + + + + -0.8 + + + + + + + + + + + + + -0.6 + + + + + + + + + + + + + -0.4 + + + + + + + + + + + + + -0.2 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + 0.2 + + + + + + + + + + + + + 0.4 + + + + + + + + + + + + + 0.6 + + + + + + + + + + + + + 0.8 + + + + + + + + + + + + + 1 + + + + + + + + + gnuplot_plot_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/guide/guide-6.svg b/guide/guide-6.svg new file mode 100644 index 0000000..a34da18 --- /dev/null +++ b/guide/guide-6.svg @@ -0,0 +1,476 @@ + + + +Gnuplot +Produced by GNUPLOT 5.4 patchlevel 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1 + + + + + + + + + + + + + -0.8 + + + + + + + + + + + + + -0.6 + + + + + + + + + + + + + -0.4 + + + + + + + + + + + + + -0.2 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + 0.2 + + + + + + + + + + + + + 0.4 + + + + + + + + + + + + + 0.6 + + + + + + + + + + + + + 0.8 + + + + + + + + + + + + + 1 + + + + + + + + + + + + + -1 + + + + + + + + + + + + + -0.8 + + + + + + + + + + + + + -0.6 + + + + + + + + + + + + + -0.4 + + + + + + + + + + + + + -0.2 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + 0.2 + + + + + + + + + + + + + 0.4 + + + + + + + + + + + + + 0.6 + + + + + + + + + + + + + 0.8 + + + + + + + + + + + + + 1 + + + + + + + + + gnuplot_plot_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gnuplot_plot_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/guide/guide.org b/guide/guide.org index 65b4a86..0051e3c 100644 --- a/guide/guide.org +++ b/guide/guide.org @@ -1,13 +1,86 @@ -This is an overview of the capabilities of =feedgnuplot=. The [[https://github.com/dkogan/feedgnuplot/][documentation]] -provides a complete reference. +* Guide -* Recipes +This is an overview of the capabilities of =feedgnuplot= and a set of example +recipes. The [[https://github.com/dkogan/feedgnuplot/][documentation]] provides a complete reference. The capabilities of +gnuplot itself are demonstrated at [[http://www.gnuplot.info/demo/][its demo page]]. First, a trivial plot: let's plot a sinusoid #+BEGIN_SRC sh :results file link :exports both -seq 100 | perl -nE 'say sin($_/5.)' | feedgnuplot --lines +seq 100 | \ + perl -nE 'say sin($_/5.)' | \ + feedgnuplot #+END_SRC #+RESULTS: [[file:guide-1.svg]] + +This was a trivial plot, and was trivially-easy to make: we gave the tool one +column of data with no specific instructions, and we got a plot. + +Here each point we plotted was 2-dimensional (has an x value an a y value), but +we passed in only one number for each point. This is what is expected without +=--domain=, so =feedgnuplot= filled in sequential integers (0, 1, 2, ...) for +the x coordinate. Without =--domain= and without =--dataid=, each line of input +is interpreted as =y0 y1 y2...=. So we can plot a sin and a cos together: + +#+BEGIN_SRC sh :results file link :exports both +seq 100 | \ + perl -nE '$th = $_/100.*2.*3.14159; $s=sin($th); $c=cos($th); say "$c $s"' | \ + feedgnuplot +#+END_SRC + +#+RESULTS: +[[file:guide-2.svg]] + +Note that, the lines may have different numbers of points. To plot the cos from +every line, but a sin from every 5th line: + +#+BEGIN_SRC sh :results file link :exports both +seq 100 | \ + perl -nE '$th = $_/100.*2.*3.14159; $s=sin($th); $c=cos($th); + if($.%5) { say "$c"; } else { say "$c $s"; }' | \ + feedgnuplot +#+END_SRC + +#+RESULTS: +[[file:guide-3.svg]] + +If we pass in two columns and =--domain=, =feedgnuplot= will use one for the x, +and the other for the y. With =--domain= and without =--dataid=, each line of +input is interpreted as =x y0 y1 y2...=. Let's plot =sin(theta)= vs. +=cos(theta)=, i.e. a circle: + +#+BEGIN_SRC sh :results file link :exports both +seq 100 | \ + perl -nE '$th = $_/100.*2.*3.14159; $s=sin($th); $c=cos($th); say "$c $s"' | \ + feedgnuplot --domain +#+END_SRC + +#+RESULTS: +[[file:guide-4.svg]] + +Hmmm. We asked for a circle, but this looks more like an ellipse. Why? Because +gnuplot is autoscaling the x and y axes independently to fill the plot window. +We can scale the axes /together/ by passing =--square=, and we get a circle: + +#+BEGIN_SRC sh :results file link :exports both +seq 100 | \ + perl -nE '$th = $_/100.*2.*3.14159; $s=sin($th); $c=cos($th); say "$c $s"' | \ + feedgnuplot --domain --square +#+END_SRC + +#+RESULTS: +[[file:guide-5.svg]] + +Again, we can have multiple =y= in each line, and each line may have a different +number of =y=. Let's plot a circle /and/ an ellipse, sampled more coarsely: +#+BEGIN_SRC sh :results file link :exports both +seq 100 | \ + perl -nE '$th = $_/100.*2.*3.14159; $s=sin($th); $c=cos($th); + if($.%5) { say "$c $s"; } else { $s2 = $s/2; say "$c $s $s2"; }' | \ + feedgnuplot --domain --square +#+END_SRC + +#+RESULTS: +[[file:guide-6.svg]]