Difference between revisions of "Gnuplot/C2/Plotting-datasets-from-file/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with "'''Title of script''': <span style="color:#000000;">'''Plot</span><span style="color:#000000;">ting datasets from file'''</span> '''Author: '''Rani Parvathy '''Keywords:'''...")
 
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''Title of script''': <span style="color:#000000;">'''Plot</span><span style="color:#000000;">ting datasets from file'''</span>
+
{|border=1
 +
||'''Visual Cue'''
 +
||'''Narration'''
  
'''Author: '''Rani Parvathy
+
|-
 +
|| '''Slide Number 1'''
 +
'''Title Slide '''
 +
|| Welcome to the tutorial on '''Plotting Dataset from a File''' in '''gnuplot'''.
  
'''Keywords:''' gnuplot, video tutorial, spoken tutorial, plot data from file, plot more than one graph, change line color, set key, set symbol size, month, year, date formatting
+
|-
 +
|| '''Slide Number 2'''
 +
'''Learning Objectives'''
 +
|| In this tutorial we will learn to,
 +
* Plot xy graph from a dataset in a file
 +
* Write the legend title
 +
* Set symbol style and size
 +
* Add two datasets in the plot
 +
* Change axis format to log scale
  
 +
|-
 +
|| '''Slide Number 3'''
 +
'''Learning Objectives'''
 +
||
 +
* Change the line color
 +
* Format the label style to scientific notation
 +
* Format the border line and
 +
* Add time stamp
  
{| style="border-spacing:0;width:6.8472in;"
 
 
|-
 
|-
! align=center style="background-color:#993366;border-top:1pt solid #000000;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | Visual Cue
+
|| '''Slide Number 4'''
! align=center style="background-color:#993366;border:1pt solid #000000;padding:0.0382in;" | Narration
+
'''System and Software Requirement'''
|-
+
|| To record this tutorial, I am using
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 1'''</div>
+
  
<div style="color:#000000;">'''Title Slide '''</div>
+
* '''Debian Linux''' 9.3
 +
* '''gnuplot 5.2.6''' and
 +
* '''Gedit''' 3.22.0
  
<div style="color:#000000;">'''Plotting datasets from file'''</div>
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Welcome to the tutorial on '''Plotting datasets from a file'''
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 2'''</div>
+
|| '''Slide Number 5'''
 +
'''Pre-requisites'''
 +
https://www.spoken-tutorial.org
 +
|| To follow this tutorial,
 +
* Learner must be familiar with, High school Mathematics.
 +
* For pre-requisite '''gnuplot''' tutorials, please visit this site.
  
<div style="color:#000000;">'''Learning Objectives'''</div>
+
|-
 +
|| Go to Desktop and cursor on '''Desktop '''.
 +
|| Go to '''Desktop''' .
 +
We will plot a graph using the data in a '''text''' file, named '''data.txt'''.
  
 +
The file is provided in the '''codefiles''' link of this tutorial.
  
 +
|-
 +
|| Show '''data.txt''' icon in '''Desktop''' directory.
 +
|| I have downloaded and saved the file on '''Desktop'''.
  
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">In this tutorial we will learn to,</div>
+
|-
 +
|| Double click on the icon.
 +
|| Double click on the file icon to open and view the file.
 +
The file opens in '''gedit''' text editor for me.
  
 +
|-
 +
|| Hover mouse and show on screen.
 +
|| The data has three columns.
 +
The first row consists of headings and starts with a hash.
  
* <div style="color:#000000;">Plot x-y graph from a dataset in a file</div>
+
|-
* <div style="color:#000000;">Add two plots in a graph</div>
+
|| Point to columns.
* <div style="color:#000000;">Write legend and set time stamp</div>
+
|| The first column contains x axis data, 2<sup>nd</sup> and 3<sup>rd</sup> columns are two sets of y data.
* <div style="color:#000000;">Change line color</div>
+
* <div style="color:#000000;">Set symbol style and size</div>
+
* <div style="color:#000000;">Change axis format and label style</div>
+
  
 +
|-
 +
|| Click on the '''x''' sign.
 +
|| Close the data file by clicking on the ''''x'''' button.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 3'''</div>
+
|| Press '''Ctrl+Alt+T '''.
 +
|| Press '''Control''', '''Alt''' & '''T''' keys together on keyboard to open the terminal.
  
<div style="color:#000000;">'''System and Software Requirement'''</div>
+
|-
 +
||
 +
|| The terminal opens.
  
 +
|-
 +
|| Type '''cd Desktop '''and press''' Enter'''.
 +
|| Change directory to '''Desktop''' directory as seen on the screen.
  
<div style="color:#000000;"></div>
+
|-
 +
|| Type '''gnuplot '''and press '''Enter'''.
 +
|| Type '''gnuplot''' at the command prompt and press '''Enter''' to open '''gnuplot'''.
  
<div style="color:#000000;"></div>
+
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">To record this tutorial, I am using</div>
+
|| Press '''Ctrl+Shift+K '''.
 +
|| I will clear the screen.
  
 +
|-
 +
|| Type '''plot "data.txt" using 1:2 title 'Y1' '''and Press '''Enter'''.
 +
|| First let's make a plot from x and y1 data columns.
 +
Enter command as seen on the screen.
  
<div style="color:#000000;">Debian Linux</div>
+
|-
 +
|| Hover mouse next to legend text.
 +
|| Here we have also added the legend text in the same command line.
  
<div style="color:#000000;">Gedit 3.22.0 and</div>
+
|-
 +
|| Hover mouse next to '''symbols'''.
 +
|| Next, let's make the symbol size larger.
  
<div style="color:#000000;">have gnuplot 5.2.5 installed</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 4'''</div>
+
|| Type '''set pointsize 1.5'''
 +
Press '''Enter'''
 +
|| To set the symbol point size, enter command, '''set pointsize 1.5'''.
  
<div style="color:#000000;">'''Samson Microphone'''</div>
+
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">To record audio, '''Samson''' '''USB''' portable microphone was used.</div>
+
|| Type '''replot''' and press '''Enter'''.
 +
|| Enter the command '''replot''', to see the updated graph.
  
 +
|-
 +
|| Narration only.
 +
|| Now, let’s plot both '''y1''' and '''y2''' data on the graph together.
  
<div style="color:#000000;">The model number '''SAGOMIC'''</div>
+
|-
 +
|| Type '''plot "data.txt" using 1:2 title 'Y1' , "data.txt" using 1:3 title 'Y2' '''
 +
and press '''Enter'''.
  
 +
|| For this purpose, use the plot command as above, in series, separated by a comma.
 +
The command is shown on the screen.
  
<div style="color:#000000;">I bought it from '''amazon''' website, for about rupees four thousand</div>
+
|-
 +
|| Point mouse on '''y''' axis.
 +
|| Next, let's set y-axis to logarithmic scale .
  
 
<div style="color:#000000;">It may be available in other websites.</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 5'''</div>
+
|| Type '''set logscale y''' and press '''Enter'''.
 +
Type '''replot''' and press '''Enter'''.
  
<div style="color:#000000;">'''Pre-requisites'''</div>
+
|| Use the command '''set space logscale space y''' to set logscale.
 +
'''Replot''' to see the result.
  
 +
|-
 +
|| Show on the screen.
 +
|| The exponential data looks as a linear line due to the logarithmic scale.
  
 +
|-
 +
|| Type '''unset logscale y '''and press '''Enter'''.
 +
|| To go back to linear scale for '''y axis''', use command, '''unset space logscale space y'''.
  
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">To follow this tutorial, learner's must be familiar with, </div>
+
|-
 +
|| Type '''replot''' and press '''Enter'''.
 +
|| Please '''replot''' to see the resulting change.
  
 +
|-
 +
|| Type '''plot "data.txt" using 1:3 with linespoints''' and press '''Enter'''.
 +
|| Next, let’s connect the data points for x and y2 data set, using a line.
 +
The command is shown on the screen.
  
<div style="color:#000000;">Basic computer and internet skills</div>
+
|-
 +
||
 +
Hover mouse next to '''linespoints'''.
 +
|| Add '''with linespoints''' command, to add a line in the graph.
  
 +
|-
 +
|| Hover mouse next to '''symbol'''.
 +
|| Let’s change symbols to larger, filled circles and color them blue.
  
<div style="color:#000000;"><span style="background-color:transparent;">Have c</span><span style="background-color:transparent;">oncept of graphing </span></div>
 
 
<div style="color:#000000;">and </div>
 
 
<span style="background-color:transparent;color:#000000;">Have h</span><span style="background-color:transparent;color:#000000;">igh school </span><span style="background-color:transparent;color:#000000;">level</span><span style="background-color:transparent;color:#000000;"> </span><span style="background-color:transparent;color:#000000;">M</span><span style="background-color:transparent;color:#000000;">ath</span><span style="background-color:transparent;color:#000000;">ematics</span><span style="background-color:transparent;color:#000000;"> skill</span><span style="background-color:transparent;color:#000000;">s</span>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 6'''</div>
+
|| Type, '''plot "data.txt" using 1:3 title 'Y2' with linespoint lc 'blue' lt 1 lw 2 pt 7 ps 1.5 ''' and press '''Enter'''.
 +
|| Enter the command, as seen on the screen.
 +
This command changes color, point style and line style.
  
<div style="color:#000000;">'''Pre-requisites'''</div>
 
 
 
<div style="color:#000000;"></div>
 
 
<div style="color:#000000;"></div>
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <span style="background-color:transparent;color:#000000;">Please locate this tutorial on our web page, </span><span style="background-color:transparent;color:#000000;">'''spoken hyphen tutorial dot org'''</span><span style="background-color:transparent;color:#000000;"> </span>
 
 
 
<div style="color:#000000;">Pre-requisite '''spoken''' '''tutorials''', if any, will be mentioned in this page </div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">Go to '''Desktop'''</div>
+
|| Hover mouse next to '''lc '''.
 +
|| Here, '''lc''' sets line color to '''blue. '''
 +
We can also use hexadecimal code for the chosen color.
  
 
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Go to '''desktop''' </div>
 
 
 
<div style="color:#000000;">We will plot a graph from data in a text file '''data dot txt''' </div>
 
 
 
<div style="color:#000000;">The file is provided with this tutorial.</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | Show data.txt icon in Desktop directory.
+
|| Hover mouse over '''lw'''.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | It is saved in the Desktop folder for me.
+
|| '''Lw''' 2 sets line width to two.
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | Double click on the icon
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Double click on the file icon to open and view the file.</div>
+
  
 
<div style="color:#000000;">File opens in '''gedit''' text editor for me</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
+
|| Hover mouse next to '''pt '''.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Data has three columns.</div>
+
|| '''Pt 7''' sets point type or symbol style to '''7''', which is a filled circle.  
  
 
<div style="color:#000000;">The first row consists of headers and starts with a hash</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |  
+
|| Hover mouse next '''ps '''.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">First column contain '''x''' data.</div>
+
|| '''Ps 1.5''' sets point size or symbol size to 1.5 .
 
+
  
<div style="color:#000000;">2<sup>nd</sup> and 3<sup>rd</sup> columns are two sets of '''y''' data.</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | Click on x sign
+
|| Show the graph with the formatting on lines and symbols.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Close the file by '''File''' > '''quit''' or click on the ''''x'''' sign
+
|| Notice the changes in the graph as specified in the command.
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | '''Press ctrl+alt+t'''
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Press control alt t, keys together on keyboard, to open a terminal
+
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | A '''terminal''' opens.
+
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | '''cd Desktop'''
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Change directory to '''Desktop''' directory as seen on the screen.
+
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Depending on your operating system, please set the '''terminal'''
+
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | '''set term qt'''
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">I will type '''set space term space qt'''. </div>
+
 
+
  
<div style="color:#000000;">This works for most operating systems</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | '''gnuplot'''
+
|| Hover mouse on y-axis scale in graph.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Type '''gnuplot''' in command prompt and press enter, to open '''gnuplot'''</div>
+
|| We may wish to change the format for axis labels on many occasions.
 +
Here, the '''y''' axis numbers have large values.
  
 
<div style="color:#000000;">I will Press '''control L''' to bring terminal prompt to top of screen, for clarity.</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
+
|| Point to the y axis numbers.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" |
+
|| We may want to use scientific notation, to represent the large numbers.
|-
+
I will use set format command for this purpose.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">Hight on screen, </div>
+
 
+
<div style="color:#000000;">'''>plot "data.txt" using 1:2 title 'Y1''''</div>
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">First let's make a plot from '''x''' and '''y1''' data columns.</div>
+
 
+
  
<div style="color:#000000;">Enter command as seen on the screen </div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | '''replot'''
+
|| Type '''set format y '%0.2e'''' and press '''Enter'''.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">'''Replot''' to see the graph</div>
+
|| Type '''set space format''', followed by axis name.
 +
Here it is '''y'''.
 +
Follow it by space and within single quotes percent sign zero point 2 e.
  
 
<div style="color:#000000;">Here we also added legend in the same command line</div>
 
 
 
<div style="color:#000000;">A graphic window opens</div>
 
 
 
<div style="color:#000000;">Next, let's make symbol size larger</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">Type '''set pointsize 1.5'''</div>
+
|| Type '''replot''' and press '''Enter'''.
 +
|| Enter the command '''replot''' to see the updated graph.
  
 
<div style="color:#000000;">Press '''enter'''</div>
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">To set symbol point size, type '''set pointsize 1.5'''</div>
 
 
 
<div style="color:#000000;">Press '''enter'''</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | '''replot'''
+
|| Press '''Ctrl+Shift+K'''.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Replot to see the updated graph</div>
+
|| I will clear the screen.
  
 
<div style="color:#000000;">You may pause the video and explore symbol size and choose a size of your choice</div>
 
|-
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Now, Say I want to compare both '''y1''' and '''y2''' data on '''x-axis'''
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">Highlight </div>
+
|| Type '''set border linewidth 2 lc 'red'''' and press '''Enter'''.
 +
Type '''replot''' and press '''Enter'''.
 +
|| We can also change the color of the border and the line width.
 +
Use the commands as shown here to change the border line color to red.
 +
I am also changing the line width to two here.
  
<div style="color:#000000;">>'''plot "data.txt" using 1:2 title 'Y1' , "data.txt" using 1:3 title 'Y2''''</div>
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">For this purpose, use the plot command as above, in series, separated by a comma</div>
 
 
 
<div style="color:#000000;">The command is shown on the screen.</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
+
|| Type '''replot''' and press '''Enter'''.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Let's set '''y'''-axis to '''logarithmic''' scale from linear next
+
|| Please '''replot''' to see the resulting change.
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''>set logscale y'''</div>
+
 
+
<div style="color:#000000;">'''replot'''</div>
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Use command '''set space logscale space y''' to set '''logscale'''.</div>
+
 
+
  
<div style="color:#000000;">'''Replot''' to see the result.</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
+
|| Type '''set timestamp''' and press''' Enter'''.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | The '''exponential''' curve change to linear line due to the '''logarithmic''' scale
+
|| Type '''set space timestamp''' to add '''time stamp''' to the graph.
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | >'''unset logscale y'''
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | To go back to linear scale for '''y-axis''', use command, '''unset space logscale space y'''
+
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | >'''replot'''
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Please '''replot''' to see the resulting change.</div>
+
 
+
  
<div style="color:#000000;"></div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | '''plot "data.txt" using 1:3 with linespoints'''
+
|| Type '''replot''' and press '''Enter'''.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Say, I desire to draw a line between data points for '''x''' and '''y2''' data set.</div>
+
|| Please '''replot''' to see the resulting change.
  
 
<div style="color:#000000;">I will use the command as seen on the screen. </div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
+
|| Hover the mouse next to the '''time stamp'''.
| style="background-color:#ffffff;border:none;padding:0in;color:#000000;" | Add with lines points in the plot command itself.
+
|| Notice that time stamp for the plot is displayed in the bottom of the plot.
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
+
| style="background-color:#ffffff;border:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Next, let's change graph properties.</div>
+
  
 
<div style="color:#000000;">Say, I want a larger size filled circle data points and color them blue.</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">Highlight on screen</div>
+
|| Type '''quit''' and press '''Enter'''.
 +
|| To quit gnuplot, enter command '''q''' or type '''quit''' at the gnuplot prompt.
  
<div style="color:#000000;">>'''plot "data.txt" using 1:3 title 'Y2' with linespoint lc 'blue' lt 1 lw 2 pt 7 ps 1.5'''</div>
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Enter the command, as seen on the screen.</div>
 
 
 
<div style="color:#000000;">This changes color, point style and </div>
 
 
<div style="color:#000000;">style line. </div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | Hover mouse next to '''lc'''
+
|| '''Slide Number 6'''
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Here, '''lc''' sets line color to '''blue. '''</div>
+
'''Summary'''
 +
|| To summarize, in this tutorial, we
 +
* Plotted data from a file
 +
* Wrote the legend title
 +
* Changed the symbol style and size
 +
* Added two datasets in the plot
 +
* Formatted the axis type
 +
* Changed the line color
  
 
<div style="color:#000000;">We can also use hexadecimal code for a chosen color.</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | Hover mouse over '''lw'''
+
|| '''Slide Number 7'''
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | '''Lw 2''' sets line width to two
+
'''Summary'''
|-
+
|| * Formatted label style to scientific notation
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | Hover mouse next to '''pt'''
+
* Changed the border line color
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | '''Pt''' sets point type or symbol style to '''7, '''which is a filled circle.
+
and
|-
+
* Learned to set time stamp
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | Hover mouse next '''ps'''
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | '''Ps''' sets point size or symbol size to 1.5
+
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | We may wish to change the format for axis labels on many occasions.
+
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | Hover mouse on y-axis range
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Here, the y-axis numbers are large.
+
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | We may want to use scientific notation.
+
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | I will use set format command for this purpose.
+
|-
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | '''>Set format y'''
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Type set space format, followed by axis name. </div>
+
  
  
<div style="color:#000000;">Here it is '''y'''.</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | ''''%0.2e''''
+
|| '''Slide Number 8'''
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Follow it by percent sign 2 e within single quotes as in the video.
+
'''Assignment'''
|-
+
|| For assignment activity, please do the following.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
+
* Type '''test''' in '''gnuplot''' prompt to see '''terminal''' capability.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | You may also use the following syntax for changing format and range.
+
* From the graphics window, choose different line style, symbol style and color.
|-
+
* Plot the graph with the chosen styles using '''data.txt''' file.
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">>'''set yrange [1:1.5e5]'''</div>
+
 
+
 
+
<div style="color:#000000;">'''ctrl -L'''</div>
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Use '''set space yrange space 1 colon 1 point 5e5 in square braces''' </div>
+
 
+
 
+
<div style="color:#000000;">This also changes format of '''y axis'''</div>
+
 
+
  
<div style="color:#000000;">I will press '''control l''' to bring terminal prompt to top of the screen for clarity.</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | '''set border linewidth 2 lc 'red''''
+
|| '''Slide Number 9'''
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">We can also change color of the border and line width.</div>
+
'''Assignment'''
 +
|| * Introduce a line break in the data file between 4<sup>th</sup> and 5<sup>th</sup> line.
 +
* This will give an empty row in the data file
 +
and
 +
* Save the file.
  
 
<div style="color:#000000;">The commands are shown on the screen.</div>
 
|-
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | We may also want to have a time stamp with the graph.
 
|-
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" | >'''set timestamp'''
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Type '''set space timestamp''' to add time stamp
 
|-
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Notice time stamp for the plot is displayed on bottom of the plot
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 7'''</div>
+
|| '''Slide Number 10'''
 
+
'''Assignment'''
<div style="color:#000000;">'''Summary'''</div>
+
||  
 
+
* Plot the data with '''linespoints''' style.
 
+
* Observe the line break in the plot at the empty row.
 
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | To summarize, in this tutorial, we
+
 
+
 
+
* <div style="color:#000000;">Plotted data from a file</div>
+
* <div style="color:#000000;">Added two plots in a graph</div>
+
* <div style="color:#000000;">Wrote legend title</div>
+
* <div style="color:#000000;">Changed line color</div>
+
 
+
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 8'''</div>
+
|| Show test window, dotted line, triangle symbol and green color graph.
 
+
Show the line break in the graph.
<div style="color:#000000;">'''Summary'''</div>
+
|| The completed assignment look similar to this.
 
+
 
+
 
+
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | * <div style="color:#000000;">Learned to change symbol style and size</div>
+
* <div style="color:#000000;">Formatted axis type and label style</div>
+
* <div style="color:#000000;">Changed border line color</div><br/><div style="color:#000000;">and</div>
+
* <div style="color:#000000;">Learned to set time stamp</div>
+
 
+
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 9'''</div>
+
|| '''Slide Number 11'''
 +
'''Spoken Tutorial Project'''
 +
|| The video at the following link summarizes the '''Spoken Tutorial Project'''.
 +
Please download and watch it.
  
<div style="color:#000000;">'''Summary'''</div>
 
 
 
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">For assignment activity, please do the following, </div>
 
 
 
* <div style="color:#000000;">Explore numbers 0-10 for color choice for line</div>
 
* <div style="color:#000000;">Explore symbol styles for number choice 0-9</div>
 
 
 
 
<div style="color:#000000;"></div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 10'''</div>
+
|| '''Slide Number 12'''
 +
'''Spoken Tutorial workshops'''
 +
The '''Spoken Tutorial Project '''team:
 +
|| We conduct workshops using spoken tutorials and give certificates.
 +
Please write to us.
  
<div style="color:#000000;">'''Spoken Tutorial Project'''</div>
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <span style="color:#000000;">This video summari</span><span style="color:#000000;">z</span><span style="color:#000000;">es the</span><span style="color:#000000;"> Spoken Tutorial Project </span>
 
 
 
<div style="color:#000000;">If you do not have good bandwidth, you may download and watch it.</div>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 11'''</div>
+
|| '''Slide Number 13'''
 +
'''Forum for specific questions:'''
 +
|| Please Post your timed queries in the forum.
  
<div style="color:#000000;">'''Spoken Tutorial workshops'''</div>
 
 
 
<div style="color:#000000;"></div>
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <span style="color:#000000;">We</span><span style="color:#000000;"> conduct workshops using spoken tutorials and give certificates. </span>
 
 
 
<span style="color:#000000;">P</span><span style="color:#000000;">lease write to us.</span>
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 12'''</div>
+
|| '''Slide Number 14'''
 +
'''Acknowledgement'''
 +
|| '''Spoken Tutorial Project''' is funded by '''NMEICT''', '''MHRD''', '''Government of India'''.
  
<div style="color:#000000;">'''Forum for specific questions:'''</div>* <div style="color:#000000;margin-left:0in;margin-right:0in;"></div>
 
 
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Post your timed queries in the forum.
 
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;" | <div style="color:#000000;">'''Slide Number 13'''</div>
+
||  
 +
|| Thank you for joining.
  
<span style="color:#000000;">'''Acknowledgemen'''</span><span style="color:#000000;">t</span>
 
 
 
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;" | <div style="color:#000000;">Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.</div>
 
 
 
 
|-
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.0382in;color:#000000;" |
 
| style="background-color:#ffffff;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.0382in;color:#000000;" | Thank you for joining.
 
 
|-
 
|-
 
|}
 
|}
<div style="color:#000000;margin-left:0in;margin-right:0in;"></div>
 

Latest revision as of 17:39, 15 November 2019

Visual Cue Narration
Slide Number 1

Title Slide

Welcome to the tutorial on Plotting Dataset from a File in gnuplot.
Slide Number 2

Learning Objectives

In this tutorial we will learn to,
  • Plot xy graph from a dataset in a file
  • Write the legend title
  • Set symbol style and size
  • Add two datasets in the plot
  • Change axis format to log scale
Slide Number 3

Learning Objectives

  • Change the line color
  • Format the label style to scientific notation
  • Format the border line and
  • Add time stamp
Slide Number 4

System and Software Requirement

To record this tutorial, I am using
  • Debian Linux 9.3
  • gnuplot 5.2.6 and
  • Gedit 3.22.0
Slide Number 5

Pre-requisites https://www.spoken-tutorial.org

To follow this tutorial,
  • Learner must be familiar with, High school Mathematics.
  • For pre-requisite gnuplot tutorials, please visit this site.
Go to Desktop and cursor on Desktop . Go to Desktop .

We will plot a graph using the data in a text file, named data.txt.

The file is provided in the codefiles link of this tutorial.

Show data.txt icon in Desktop directory. I have downloaded and saved the file on Desktop.
Double click on the icon. Double click on the file icon to open and view the file.

The file opens in gedit text editor for me.

Hover mouse and show on screen. The data has three columns.

The first row consists of headings and starts with a hash.

Point to columns. The first column contains x axis data, 2nd and 3rd columns are two sets of y data.
Click on the x sign. Close the data file by clicking on the 'x' button.
Press Ctrl+Alt+T . Press Control, Alt & T keys together on keyboard to open the terminal.
The terminal opens.
Type cd Desktop and press Enter. Change directory to Desktop directory as seen on the screen.
Type gnuplot and press Enter. Type gnuplot at the command prompt and press Enter to open gnuplot.
Press Ctrl+Shift+K . I will clear the screen.
Type plot "data.txt" using 1:2 title 'Y1' and Press Enter. First let's make a plot from x and y1 data columns.

Enter command as seen on the screen.

Hover mouse next to legend text. Here we have also added the legend text in the same command line.
Hover mouse next to symbols. Next, let's make the symbol size larger.
Type set pointsize 1.5

Press Enter

To set the symbol point size, enter command, set pointsize 1.5.
Type replot and press Enter. Enter the command replot, to see the updated graph.
Narration only. Now, let’s plot both y1 and y2 data on the graph together.
Type plot "data.txt" using 1:2 title 'Y1' , "data.txt" using 1:3 title 'Y2'

and press Enter.

For this purpose, use the plot command as above, in series, separated by a comma.

The command is shown on the screen.

Point mouse on y axis. Next, let's set y-axis to logarithmic scale .
Type set logscale y and press Enter.

Type replot and press Enter.

Use the command set space logscale space y to set logscale.

Replot to see the result.

Show on the screen. The exponential data looks as a linear line due to the logarithmic scale.
Type unset logscale y and press Enter. To go back to linear scale for y axis, use command, unset space logscale space y.
Type replot and press Enter. Please replot to see the resulting change.
Type plot "data.txt" using 1:3 with linespoints and press Enter. Next, let’s connect the data points for x and y2 data set, using a line.

The command is shown on the screen.

Hover mouse next to linespoints.

Add with linespoints command, to add a line in the graph.
Hover mouse next to symbol. Let’s change symbols to larger, filled circles and color them blue.
Type, plot "data.txt" using 1:3 title 'Y2' with linespoint lc 'blue' lt 1 lw 2 pt 7 ps 1.5 and press Enter. Enter the command, as seen on the screen.

This command changes color, point style and line style.

Hover mouse next to lc . Here, lc sets line color to blue.

We can also use hexadecimal code for the chosen color.

Hover mouse over lw. Lw 2 sets line width to two.
Hover mouse next to pt . Pt 7 sets point type or symbol style to 7, which is a filled circle.
Hover mouse next ps . Ps 1.5 sets point size or symbol size to 1.5 .
Show the graph with the formatting on lines and symbols. Notice the changes in the graph as specified in the command.
Hover mouse on y-axis scale in graph. We may wish to change the format for axis labels on many occasions.

Here, the y axis numbers have large values.

Point to the y axis numbers. We may want to use scientific notation, to represent the large numbers.

I will use set format command for this purpose.

Type set format y '%0.2e' and press Enter. Type set space format, followed by axis name.

Here it is y. Follow it by space and within single quotes percent sign zero point 2 e.

Type replot and press Enter. Enter the command replot to see the updated graph.
Press Ctrl+Shift+K. I will clear the screen.
Type set border linewidth 2 lc 'red' and press Enter.

Type replot and press Enter.

We can also change the color of the border and the line width.

Use the commands as shown here to change the border line color to red. I am also changing the line width to two here.

Type replot and press Enter. Please replot to see the resulting change.
Type set timestamp and press Enter. Type set space timestamp to add time stamp to the graph.
Type replot and press Enter. Please replot to see the resulting change.
Hover the mouse next to the time stamp. Notice that time stamp for the plot is displayed in the bottom of the plot.
Type quit and press Enter. To quit gnuplot, enter command q or type quit at the gnuplot prompt.
Slide Number 6

Summary

To summarize, in this tutorial, we
  • Plotted data from a file
  • Wrote the legend title
  • Changed the symbol style and size
  • Added two datasets in the plot
  • Formatted the axis type
  • Changed the line color
Slide Number 7

Summary

* Formatted label style to scientific notation
  • Changed the border line color

and

  • Learned to set time stamp


Slide Number 8

Assignment

For assignment activity, please do the following.
  • Type test in gnuplot prompt to see terminal capability.
  • From the graphics window, choose different line style, symbol style and color.
  • Plot the graph with the chosen styles using data.txt file.
Slide Number 9

Assignment

* Introduce a line break in the data file between 4th and 5th line.
  • This will give an empty row in the data file

and

  • Save the file.
Slide Number 10

Assignment

  • Plot the data with linespoints style.
  • Observe the line break in the plot at the empty row.
Show test window, dotted line, triangle symbol and green color graph.

Show the line break in the graph.

The completed assignment look similar to this.
Slide Number 11

Spoken Tutorial Project

The video at the following link summarizes the Spoken Tutorial Project.

Please download and watch it.

Slide Number 12

Spoken Tutorial workshops The Spoken Tutorial Project team:

We conduct workshops using spoken tutorials and give certificates.

Please write to us.

Slide Number 13

Forum for specific questions:

Please Post your timed queries in the forum.
Slide Number 14

Acknowledgement

Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.
Thank you for joining.

Contributors and Content Editors

Madhurig, Ranipv076, Snehalathak