Difference between revisions of "Gnuplot"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
Line 22: Line 22:
 
==Basic Level==
 
==Basic Level==
  
'''1.Installation of Gnuplot on Windows OS'''
+
'''1. Overview of Gnuplot'''
 +
 
 +
* What is gnuplot
 +
* Visit gnuplot website
 +
* About popularity of gnuplot
 +
* Books on gnuplot
 +
* Learn about example scripts
 +
* Documentation on gnuplot
 +
* Features of gnuplot
 +
* Benefits of gnuplot
 +
* About the list of tutorials on gnuplot
 +
 
 +
'''2.Installation of Gnuplot on Windows OS'''
  
 
* Familiarize with gnuplot website and download gnuplot
 
* Familiarize with gnuplot website and download gnuplot
Line 33: Line 45:
  
  
'''2. Introduction to Gnuplot'''
+
'''3. Introduction to Gnuplot'''
  
 
* Familiarize with gnuplot website and download gnuplot 5.2.6
 
* Familiarize with gnuplot website and download gnuplot 5.2.6
Line 44: Line 56:
  
  
'''3. Example scripts and demo folder'''
+
'''4. Example scripts and demo folder'''
  
 
* Learn about the demo folder in the downloaded tarball which contain example files
 
* Learn about the demo folder in the downloaded tarball which contain example files
Line 56: Line 68:
  
  
'''4. Plotting Functions'''
+
'''5. Plotting Functions'''
  
 
* Plot sin(x), cos(x) and sin(x) + cos(x)
 
* Plot sin(x), cos(x) and sin(x) + cos(x)
Line 70: Line 82:
  
  
''' 5. Set term and variations in output
+
''' 6. Set term and variations in output
  
 
* Set term command and help option
 
* Set term command and help option
Line 83: Line 95:
  
  
'''6. Plotting datasets from file'''
+
'''7. Plotting datasets from file'''
  
 
* Plot datasets from a file
 
* Plot datasets from a file
Line 99: Line 111:
 
==Intermediate Level==
 
==Intermediate Level==
  
'''7. Generate 3D plots and surfaces'''
+
'''8. Generate 3D plots and surfaces'''
  
 
* Generate a 3D plot with splot command
 
* Generate a 3D plot with splot command
Line 113: Line 125:
  
  
'''8. Multiple plots in a canvas'''
+
'''9. Multiple plots in a canvas'''
  
 
* Set gnuplot to multiplot mode
 
* Set gnuplot to multiplot mode
Line 126: Line 138:
  
  
'''9. Error bars and data fitting'''
+
'''10. Error bars and data fitting'''
  
 
* Add error bars to a plot
 
* Add error bars to a plot
Line 141: Line 153:
 
==Advanced Level==
 
==Advanced Level==
  
'''10. Latex and gnuplot'''
+
'''11. Latex and gnuplot'''
  
 
* Write a gnuplot script incorporating Latex symbols in gnuplot
 
* Write a gnuplot script incorporating Latex symbols in gnuplot
Line 155: Line 167:
  
  
'''11. Statistics and box plot'''
+
'''12. Statistics and box plot'''
  
 
* Plot string data on x-axis
 
* Plot string data on x-axis
Line 169: Line 181:
  
  
'''12. Run gnuplot from Perl script'''
+
'''13. Run gnuplot from Perl script'''
  
 
* Run gnuplot commands using a Perl script
 
* Run gnuplot commands using a Perl script

Latest revision as of 17:09, 26 April 2024

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. Overview of Gnuplot

  • What is gnuplot
  • Visit gnuplot website
  • About popularity of gnuplot
  • Books on gnuplot
  • Learn about example scripts
  • Documentation on gnuplot
  • Features of gnuplot
  • Benefits of gnuplot
  • About the list of tutorials on gnuplot

2.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


3. 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


4. 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


5. 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


6. 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


7. 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

8. 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


9. 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


10. 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

11. 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


12. 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


13. 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