From SWP Wiki
Jump to: navigation, search

Getting plot from SWP: using Gnuokit



SWP does not make plots itself but using Gnuplot instead. Gnuplot have to be installed manually. It could be downloaded from official site

SWP doesn't have to know Gnuplot language, although it might be usefull.

Installing Gnuplot

Download Gnuplot from official site

Most of linux users could install Gnuplot following standard package installation procedure of their linux distribution.

Configuring Gnuplot

For correct Gnuplot work for SWP

  • Gnuplot diretory have to be listed in PATH environment variable
  • Gnuplot should be named gnuplot (linux) or gnuplot.exe (Windows).

In case of linux all package executables are usually installed to /bin or /usr/bin directory listed in $PATH by default, no user action required.

In Windows Gnuplot Setup should ask to add Gnuplot to PATH. If it was rejected or in case of manual install this should be done manually by altering corresponding system option.

If Gnuplot executable differs from gnuplot or gnuplot.exe there is two options

(a) create executable file in linux named gnuplot:


in Windows named gnuplot.bat


and place it to PATH listed directory.

(b) modify SWP variable $gnuplot in each script:


Plotting concept

Gnuplot like SWP is a script language interpreter. SWP language functions could make Gnuplot and call Gnuplot automatically to generate plots in EPS (Encapsulated PostScript) format. Resulting files could be used in most of modern graphical software and \(\LaTeX\) system.

SWP could not fully eliminate invalid Gnuplot script creation, in this case knowledge of Gnuplot could be useful to detect why EPS file was not created and fixing SWP sctipt.

Calling Gnuplot is realised through command shell — gnuplot command. This may be changed by altering $gnuplot script variable.

SWP saves Gnuplot script to file with .plt extension and call Gnuplot to run this script. Is the file already exists, SWP checks if new script differs from older one and call Gnuplot only if a difference is found.

Plot making

Plot making process could be divided into two stages. First is to create plot elements and second is to place them onto plot.

Plot elements could be of two types called lines and arrows. They are created by plot_line and plot_arrow functions correspondingly.

Lines are main plot elements. Lines could be a plot of real function or dotted set plot. For example, plot of dotted set could be created (each point of set is one dot on the plot). Another example is to plot tabulated function using straight line segments between points. Or to plot histogram, etc.

Arrows is additional plot elements. They are straight line segments or vectors or two-end arrows. Ends coordinated are entered manually originated from plot or paper coordinate system.

Plots are created by plot function.

Personal tools
In other languages