From Script | Spoken-Tutorial
Jump to: navigation, search


Gnuplot is a command-line driven cross platform graphing software. The source code is copyrighted but freely available. gnuplot can plot 2D and 3D graphs, draw surface, generate heat map, plot and fit mathematical functions. gnuplot supports many non-interactive uses such as web scripting. Plotting back-end of several softwares such as octave is gnuplot. It can also be used in conjunction with Latex and many other such programs.

At the time of writing, the software is developed actively. It supports interactive plotting and saves the plot to various output file formats. Vast number of resources, in terms of user forum, example scripts, books and documentation is available and the program is actively developed at present. For latest updates, visit the official site at .

The software supports multiplot mode for plotting, contour map, axis transformation such as logscale and several such options. Generate graphics output files in different formats such as pdf, postscript, svg, or ASCII.

Statistical summary of large datasets, such as median, quartile range, variance, quartile range, average and standard deviation can be generated using gnuplot. Plots such as Boxplot, violin plot, and volcano plot used in large data analysis can be generated manually or can be automated to user defined preferences.

Data fitting by non-linear regression with user specified mathematical functions are possible. Gnuplot can generate Latex files for the plots, and produce svg format files. gnuplot allows incorporation into many programming languages such as C, R or Python.

Contributors, Content Editors and Reviewers

The gnuplot Spoken Tutorial is put together by Dr. Rani Parvathy from IIT Bombay. Ms. Vaishnavi Gollanapalli contributed as the domain reviewer. Ms. Madhuri Ganapathi, contributed as an internal reviewer, Ms. Himanshi Karwanje is the novice reviewer and Dr. Snehalatha Kaliappan is the administrative reviewer.

Learner: Anyone who want to draw 2D or 3D graphs, as well as Researchers.

Basic Level

1.Installation of Gnuplot on Windows OS

  • Familiarize with gnuplot website and download gnuplot
  • Install gnuplot in Windows 10 OS
  • Open the console version of gnuplot
  • Check terminal capability with test command
  • Familiarize with wxt terminal tool bar
  • Open the app version of gnuplot
  • Check the terminal capability with test command for app version

2. Introduction to Gnuplot

  • Familiarize with gnuplot website and download gnuplot 5.2.6
  • Extract files from tarball
  • Build the gnuplot software
  • Open the installed gnuplot software
  • Check terminal capability with test command
  • Open the Graphics window
  • Learn the capability of X11 terminal

3. Example scripts and demo folder

  • Learn about the demo folder in the downloaded tarball which contain example files
  • Familiarize with script structure, and headers
  • Load a script file to generate plot
  • Learn about examples of Interactive scripts
  • Load a 3D plot demo to ggenerate plot
  • Accessing online gnuplot example files
  • About styles supported in gnuplot
  • About help forum

4. Plotting Functions

  • Plot sin(x), cos(x) and sin(x) + cos(x)
  • Add and remove grid
  • Zoom in and zoom out of the graph
  • Move the legend position
  • Add title to the plot
  • Add more than one function to the graph
  • Change the font style and size
  • Access help documentation for the font
  • About set and unset table command
  • Save the data points to a file

5. Set term and variations in output

  • Set term command and help option
  • Set different terminals for plotting
  • About Interactive terminals
  • Printing to postscript and svg files
  • Postscript file output in portrait or landscape orientation
  • Change the background color in svg output file
  • Save the terminal setting
  • Reset terminal
  • Set terminal to dumb for ASCII output and generate output of sin(x) vs x plot

6. Plotting datasets from file

  • Plot datasets from a file
  • Choose x and y data from a multi-column file
  • Specify legend title in the plot
  • Set and unset logarithmic scale for y-axis
  • Set line width in the plot
  • Set color of the line
  • Change symbol size and style
  • Change y-axis ticks to scientific notation
  • Adjust border line color and line width
  • Add time stamp to the plot

Intermediate Level

7. Generate 3D plots and surfaces

  • Generate a 3D plot with splot command
  • Rotate the graph to change the viewing angle
  • Color the two sides of the surface differently
  • Use set isosamples command to define a fine grid
  • About equation for a sphere in parametric form
  • Write and modify a script to plot a graph
  • Plot a sphere with splot command
  • Change the color of the sphere
  • Generate a heat map with pm3d command
  • About color scale bar

8. Multiple plots in a canvas

  • Set gnuplot to multiplot mode
  • Define the position and size of each plot on the canvas
  • Perform an iterative modification of the script
  • Change the graph properties step by step
  • Incorporate a background object in the graph
  • Change object color in the multiplot mode
  • Generate a file of the multiplot graph for printing or sharing
  • Specify the size of the output file
  • Unset the multiplot mode to return to gnuplot prompt

9. Error bars and data fitting

  • Add error bars to a plot
  • Steps in fitting the data to an equation
  • Define an equation to fit a given set of data points
  • Set initial guess value for the coefficients in the equation
  • Run the data fitting process
  • Analyze the output results
  • Plot fitted data and starting data together
  • Add an arrow object in the graph
  • Unset an object to remove it from the graph

Advanced Level

10. Latex and gnuplot

  • Write a gnuplot script incorporating Latex symbols in gnuplot
  • Incorporate superscript and subscript in the latex symbols
  • Learn the pause command
  • Show Latex symbols in gnuplot graphics window
  • Write the gnuplot graph to a tex file
  • Incorporate variations in the pause command
  • Compile the latex file in gnuplot
  • Generate a pdf file
  • Show the Greek Latex symbols in the pdf file
  • Use pdfcrop to crop the output file

11. Statistics and box plot

  • Plot string data on x-axis
  • Specify xtics position for the string label
  • Generate statistical summary with stats command
  • About the statistical summary generated by gnuplot
  • Make a datafile to draw candlestick plot
  • Draw a candlestick plot
  • Draw a box plot
  • Specify the position for the box plot on axis
  • Plot outliers in the box plot
  • Draw box plot without outliers

12. Run gnuplot from Perl script

  • Run gnuplot commands using a Perl script
  • Generate statistical summary for multiple input data files from gnuplot using Perl script
  • Save the statistical summary files with different file names
  • Calculate the upper limit for the boxplot generated by gnuplot
  • Filter outlier data points of the boxplots using Perl script
  • Save the outlier data points in a different file
  • Append outlier data to a file
  • Plot multiple boxplots in a graph
  • Label outliers in boxplot using Perl script commands
  • Use foreach, while and if loops in Perl script

Contributors and Content Editors