Difference between revisions of "Gnuplot"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
Line 3: Line 3:
 
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.
 
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 writting, 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 http://www.gnuplot.info .
+
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 http://www.gnuplot.info .
  
 
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.  
 
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.  
Line 11: Line 11:
 
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.
 
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
+
'''Contributors, Content Editors and Reviewers'''
  
The gnuplot Spoken Tutorial is put together by Dr. Rani PV from IIT Bombay. Ms. Vaishnavi contributed as the domain reviewer. Ms. Madhuri Ganapathi, contributed as an internal reviewer, Ms. Himanshi Kukreja is the novice reviewer and Dr. Snehalatha Kaliappan is the administrative reviewer.
+
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.
 
'''Learner''': Anyone who want to draw 2D or 3D graphs, as well as Researchers.
Line 23: Line 23:
  
 
'''1.Installation of Gnuplot on Windows OS'''
 
'''1.Installation of Gnuplot on Windows OS'''
 +
 
* Familiarize with gnuplot website and download gnuplot
 
* Familiarize with gnuplot website and download gnuplot
 
* Install gnuplot in Windows 10 OS
 
* Install gnuplot in Windows 10 OS
Line 30: Line 31:
 
* Open the app version of gnuplot
 
* Open the app version of gnuplot
 
* Check the terminal capability with test command for app version
 
* Check the terminal capability with test command for app version
 +
  
 
'''2. Introduction to Gnuplot'''
 
'''2. Introduction to Gnuplot'''
 +
 
* Familiarize with gnuplot website and download gnuplot 5.2.6
 
* Familiarize with gnuplot website and download gnuplot 5.2.6
 
* Extract files from tarball  
 
* Extract files from tarball  
Line 40: Line 43:
 
* Learn the capability of X11 terminal
 
* Learn the capability of X11 terminal
  
# 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
 
  
# Plotting Functions
+
'''3. Example scripts and demo folder'''
#* Plot sin(x), cos(x) and sin(x) + cos(x)
+
 
#* Add and remove grid
+
* Learn about the demo folder in the downloaded tarball which contain example files
#* Zoom in and zoom out of the graph
+
* Familiarize with script structure, and headers
#* Move the legend position  
+
* Load a script file to generate plot
#* Add title to the plot  
+
* Learn about examples of Interactive scripts
#* Add more than one function to the graph
+
* Load a 3D plot demo to ggenerate plot
#* Change the font style and size
+
* Accessing online gnuplot example files
#* Access help documentation for the font
+
* About styles supported in gnuplot
#* About set and unset table command
+
* About help forum
#* Save the data points to a file
+
 
# Set term and variations in output
+
 
#* Set term command and help option
+
'''4. Plotting Functions'''
#* Set different terminals for plotting
+
 
#* About Interactive terminals
+
* Plot sin(x), cos(x) and sin(x) + cos(x)
#* Printing to postscript and svg files
+
* Add and remove grid
#* Postscript file output in portrait or landscape orientation  
+
* Zoom in and zoom out of the graph
#* Change the background color in svg output file
+
* Move the legend position  
#* Save the terminal setting
+
* Add title to the plot  
#* Reset terminal
+
* Add more than one function to the graph
#* Set terminal to dumb for ASCII output and generate output of sin(x) vs x plot
+
* 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
 +
 
  
# 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==
 
==Intermediate Level==
  
# Generate 3D plots and surfaces
+
'''7. Generate 3D plots and surfaces'''
#* Generate a 3D plot with splot command
+
 
#* Rotate the graph to change the viewing angle
+
* Generate a 3D plot with splot command
#* Color the two sides of the surface differently
+
* Rotate the graph to change the viewing angle
#* Use set isosamples command to define a fine grid
+
* Color the two sides of the surface differently
#* About equation for a sphere in parametric form
+
* Use set isosamples command to define a fine grid
#* Write and modify a script to plot a graph
+
* About equation for a sphere in parametric form
#* Plot a sphere with splot command
+
* Write and modify a script to plot a graph
#* Change the color of the sphere
+
* Plot a sphere with splot command
#* Generate a heat map with pm3d command
+
* Change the color of the sphere
#* About color scale bar
+
* Generate a heat map with pm3d command
# Multiple plots in a canvas
+
* About color scale bar
#* Set gnuplot to multiplot mode
+
 
#* Define the position and size of each plot on the canvas
+
 
#* Perform an iterative modification of the script
+
'''8. Multiple plots in a canvas'''
#* Change the graph properties step by step
+
 
#* Incorporate a background object in the graph
+
* Set gnuplot to multiplot mode
#* Change object color in the multiplot mode
+
* Define the position and size of each plot on the canvas
#* Generate a file of the multiplot graph for printing or sharing
+
* Perform an iterative modification of the script
#* Specify the size of the output file
+
* Change the graph properties step by step
#* Unset the multiplot mode to return to gnuplot prompt
+
* Incorporate a background object in the graph
# Error bars and data fitting
+
* Change object color in the multiplot mode
#* Add error bars to a plot
+
* Generate a file of the multiplot graph for printing or sharing
#* Steps in fitting the data to an equation
+
* Specify the size of the output file
#* Define an equation to fit a given set of data points
+
* Unset the multiplot mode to return to gnuplot prompt
#* Set initial guess value for the coefficients in the equation
+
 
#* Run the data fitting process
+
 
#* Analyze the output results
+
'''9. Error bars and data fitting'''
#* Plot fitted data and starting data together
+
 
#* Add an arrow object in the graph
+
* Add error bars to a plot
#* Unset an object to remove it from the graph
+
* 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==
 
==Advanced Level==
  
# Latex and gnuplot
+
'''10. Latex and gnuplot'''
#* Write a gnuplot script incorporating Latex symbols in gnuplot
+
 
#* Incorporate superscript and subscript in the latex symbols
+
* Write a gnuplot script incorporating Latex symbols in gnuplot
#* Learn the pause command
+
* Incorporate superscript and subscript in the latex symbols
#* Show Latex symbols in gnuplot graphics window
+
* Learn the pause command
#* Write the gnuplot graph to a tex file
+
* Show Latex symbols in gnuplot graphics window
#* Incorporate variations in the pause command
+
* Write the gnuplot graph to a tex file
#* Compile the latex file in gnuplot
+
* Incorporate variations in the pause command
#* Generate a pdf file
+
* Compile the latex file in gnuplot
#* Show the Greek Latex symbols in the pdf file
+
* Generate a pdf file
#* Use pdfcrop to crop the output file
+
* Show the Greek Latex symbols in the pdf file
# Statistics and box plot
+
* Use pdfcrop to crop the output file
#* Plot string data on x-axis
+
 
#* Specify xtics position for the string label
+
 
#* Generate statistical summary with stats command
+
'''11. Statistics and box plot'''
#* About the statistical summary generated by gnuplot
+
 
#* Make a datafile to draw candlestick plot
+
* Plot string data on x-axis
#* Draw a candlestick plot
+
* Specify xtics position for the string label
#* Draw a box plot
+
* Generate statistical summary with stats command
#* Specify the position for the box plot on axis
+
* About the statistical summary generated by gnuplot
#* Plot outliers in the box plot
+
* Make a datafile to draw candlestick plot
#* Draw box plot without outliers
+
* Draw a candlestick plot
# Run gnuplot from Perl script
+
* Draw a box plot
#* Run gnuplot commands using a Perl script
+
* Specify the position for the box plot on axis
#* Generate statistical summary for multiple input data files from gnuplot using Perl script
+
* Plot outliers in the box plot
#* Save the statistical summary files with different file names
+
* Draw box plot without outliers
#* 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
+
  
#*
+
'''12. Run gnuplot from Perl script'''
  
Contributors and Content Editors
+
* Run gnuplot commands using a Perl script
Dr. Rani Parvathy V, Ms. Vaishnavi , Madhuri Ganapathi, Dr. Snehalatha Kaliappan
+
* 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

Latest revision as of 16:13, 8 October 2020

Gnuplot

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 http://www.gnuplot.info .

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

Madhurig