Plotting and Fitting using Gnuplot

Gnuplot is a command-line program that is used mainly for plotting data.  It is my favourite plotting program that I have been using since my undergraduate days..

I have been collecting commands that I frequently use into a text file.
Here, I have decided to help share a few basic examples that I hope can benefit you..

Before starting, i strongly suggest you to write your commands into a notepad file..
Typically, i would save it as a [.plt] file but you can also save it as a [.txt] file.
Using this file, you can load it into gnuplot but first, make sure you change the folder location.

gnuplot > cd ‘c:\windows\user\desktop’
gnuplot > load ‘filename.plt’


  1. Terminals – How does Gnuplot works?
  2. Plotting Functions or Equations in Gnuplot
  3. Importing Data into Gnuplot
  4. Plotting Data in Gnuplot
  5. Adding labels 
  6. Linear fitting with Hooke’s Law
  7. Non-linear fitting for a non-periodic signal
  8. Non-linear fitting for a decaying, single frequency with DC offset.
  9. Non-linear fitting for a decaying, multi-frequency with DC offset.