manpagez: man pages & more
info gnuplot
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.4.1 New syntax

This version of gnuplot introduces command iteration and block-structured if/else/while/do constructs. See ‘if‘, ‘while‘, and ‘do‘. Simple iteration is possible inside ‘plot‘ or ‘set‘ commands. See iteration. General iteration spanning multiple commands is possible using a block construct as shown below. For a related new feature, see the ‘summation‘ expression type. Here is an example using several of these new syntax features:

      set multiplot layout 2,2
      fourier(k, x) = sin(3./2*k)/k * 2./3*cos(k*x)
      do for [power = 0:3] {
          TERMS = 10**power
          set title sprintf("%g term Fourier series",TERMS)
          plot 0.5 + sum [k=1:TERMS] fourier(k,x) notitle 
      }
      unset multiplot

It is now possible to select a column of data from a data file by matching a label in the first row of the file. See columnhead. For example

      plot for [crop in "Oats Peas Beans"] 'data' using "Year":crop


This document was generated on November 1, 2013 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.