Difference between revisions of "Gnuplot/C2/Set-term-and-variations-in-output/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
|-
 
|-
 
|| '''Slide Number 1'''
 
|| '''Slide Number 1'''
 +
 
'''Title Slide '''
 
'''Title Slide '''
 
|| Welcome to the tutorial on '''Set Term and Variations in Output''' in '''gnuplot'''.
 
|| Welcome to the tutorial on '''Set Term and Variations in Output''' in '''gnuplot'''.
Line 10: Line 11:
 
|-
 
|-
 
|| '''Slide Number 2'''
 
|| '''Slide Number 2'''
 +
 
'''Learning Objectives'''
 
'''Learning Objectives'''
 
|| In this tutorial we will learn about,
 
|| In this tutorial we will learn about,
Line 19: Line 21:
 
|-
 
|-
 
|| '''Slide Number 3'''
 
|| '''Slide Number 3'''
 +
 
'''Learning Objectives'''
 
'''Learning Objectives'''
 
||
 
||
Line 27: Line 30:
 
|-
 
|-
 
|| '''Slide Number 4'''
 
|| '''Slide Number 4'''
'''System and Software Requirement'''
+
 
 +
'''System Requirements'''
 
|| To record this tutorial, I am using
 
|| To record this tutorial, I am using
 
* '''Debian Linux''' 9.3
 
* '''Debian Linux''' 9.3
Line 35: Line 39:
 
|-
 
|-
 
|| '''Slide Number 5'''
 
|| '''Slide Number 5'''
 +
 
'''Pre-requisites'''
 
'''Pre-requisites'''
 +
 
[https://spoken-tutorial.org/ https://spoken-tutorial.org/]
 
[https://spoken-tutorial.org/ https://spoken-tutorial.org/]
 
|| To follow this tutorial,  
 
|| To follow this tutorial,  
Line 45: Line 51:
 
Type '''cd Desktop''' and press '''Enter'''.
 
Type '''cd Desktop''' and press '''Enter'''.
 
|| Open the terminal and change the working directory to '''Desktop'''.
 
|| Open the terminal and change the working directory to '''Desktop'''.
 +
 
Enter the command as seen on the screen.
 
Enter the command as seen on the screen.
  
Line 160: Line 167:
 
|-
 
|-
 
|| Press '''Control+Shift+K'''
 
|| Press '''Control+Shift+K'''
|| I will clear the '''terminal'''.
+
|| I will clear the '''screen'''.
  
 
|-
 
|-
Line 200: Line 207:
 
|-
 
|-
 
|| Press '''Control+Shift+K'''
 
|| Press '''Control+Shift+K'''
|| I will clear the '''terminal'''.
+
|| I will clear the '''screen'''.
  
 
|-
 
|-
Line 366: Line 373:
 
* Saved the '''terminal''' setting
 
* Saved the '''terminal''' setting
 
* Reset the '''terminal''' setting
 
* Reset the '''terminal''' setting
 +
 +
|-
 +
 +
|| '''Slide Number 7'''
 +
 +
'''Summary'''
 +
||
 
* Learned about '''dumb''' terminal command  
 
* Learned about '''dumb''' terminal command  
 
and
 
and
 
* Generated an '''ASCII''' output
 
* Generated an '''ASCII''' output
 
 
|-
 
|-
|| '''Slide Number 7'''
+
 
 +
|| '''Slide Number 8'''
 +
 
 
'''Assignment 1'''
 
'''Assignment 1'''
 
|| For assignment, plot the following functions,
 
|| For assignment, plot the following functions,
Line 378: Line 393:
  
 
|-
 
|-
|| '''Slide Number 8'''
+
|| '''Slide Number 9'''
 +
 
 
'''Assignment 2'''
 
'''Assignment 2'''
|| For assignment, plot the following functions,
+
||  
 
* Set terminal to '''dumb'''.
 
* Set terminal to '''dumb'''.
 
* Generate '''cos(x) versus x''' plot in '''ASCII''' format.
 
* Generate '''cos(x) versus x''' plot in '''ASCII''' format.
Line 389: Line 405:
  
 
|-
 
|-
|| '''Slide Number 9'''
+
|| '''Slide Number 10'''
'''Spoken Tutorial Project'''
+
'''About the Spoken Tutorial Project'''
 
|| This video summarises the '''Spoken Tutorial Project'''.
 
|| This video summarises the '''Spoken Tutorial Project'''.
 
Please download and watch it.
 
Please download and watch it.
  
 
|-
 
|-
|| '''Slide Number 10'''
+
|| '''Slide Number 11'''
 
'''Spoken Tutorial workshops'''
 
'''Spoken Tutorial workshops'''
 
|| We conduct workshops and give certificates.  
 
|| We conduct workshops and give certificates.  
Line 401: Line 417:
  
 
|-
 
|-
|| '''Slide Number 11'''
+
|| '''Slide Number 12'''
'''Forum for specific questions'''
+
'''Forum for Specific Questions'''
 
|| Please Post your timed queries in the forum.
 
|| Please Post your timed queries in the forum.
  
 
|-
 
|-
|| '''Slide Number 12'''
+
|| '''Slide Number 13'''
'''Acknowledgement'''
+
'''Acknowledgements'''
 
|| Spoken Tutorial Project is funded by '''NMEICT''', '''MHRD''', '''Government of India'''.
 
|| Spoken Tutorial Project is funded by '''NMEICT''', '''MHRD''', '''Government of India'''.
  

Latest revision as of 17:56, 29 November 2019

Visual Cue Narration
Slide Number 1

Title Slide

Welcome to the tutorial on Set Term and Variations in Output in gnuplot.
Slide Number 2

Learning Objectives

In this tutorial we will learn about,
  • Interactive terminal setting
  • Generating a plot for printing and sharing
  • Save the plot in postscript and svg image formats
  • Save and reset the terminal setting
Slide Number 3

Learning Objectives

  • ASCII output command

and

  • Plot sin(x)-x plot in ASCII format
Slide Number 4

System Requirements

To record this tutorial, I am using
  • Debian Linux 9.3
  • gnuplot 5.2.6 and
  • gedit text editor 3.22
Slide Number 5

Pre-requisites

https://spoken-tutorial.org/

To follow this tutorial,
  • Learner must be familiar with high school Mathematics.
  • For pre-requisite tutorials, please visit this site.
Press Ctrl+Alt+T.

Type cd Desktop and press Enter.

Open the terminal and change the working directory to Desktop.

Enter the command as seen on the screen.

Type gnuplot, and press Enter. Type gnuplot and press Enter to open gnuplot.
Hover mouse next to term X11. Notice, the terminal type is shown here as x11.

For some users qt or wxt terminal will be the default terminal.

Cursor on the terminal. Gnuplot supports several types of terminals.

Let’s open the details about terminal types using the help documentation.

Press Control+Shift+K. I will clear the screen.
Type help set term and press Enter . Enter the command help space set space term.
Hover mouse over set terminal. The help documentation for the terminal opens.
Point to the set terminal command. The set terminal command allows to set, the type of output to be generated.
Hover mouse over set output. This is commonly used together with set output command.

This directs the output to a file or a device.

Hover mouse over Press return for more.

Press Enter. Press Enter again.

The prompt reads as, Press return for more.

So, press Enter.

Press Enter again, till you notice the terminal list on the screen.

Hover mouse on the terminals shown on the screen. Nearly 40 types of terminals are supported by gnuplot.
Hover mouse over x11, xterm. For example, x11 and xterm are interactive terminals.

They help to plot graphs on the screen.

Hover mouse over postscript, pdf, svg. Postscript and svg terminals direct output to a file in their respective formats.

The output can be saved and edited by the user.

Point mouse to terminals available. These aid the user in printing and sharing of graphs.
Cursor on the terminal. Next, we will explore the options for postscript terminal.
Hover mouse near subtopic. The prompt is at subtopic of set term indicating the user to enter a subtopic.
Cursor on the terminal. Let's access help files for postscript file generation.
Type postscript and press Enter. I will type postscript in the subtopic of set term prompt and press Enter.
Hover mouse over syntax seen on screen. Detailed syntax options for generating postscript file is shown on the screen.
Hover mouse over landscape | portrait . The orientation can be set to landscape or portrait.
Hover mouse below on color, duplex and size. Color, duplex option and size of the plot and other details can also be set here.
Press Enter. Press Enter as seen at the prompt.
Show on screen help setting. More details about the settings appear on the screen.
You may pause the video and explore more about the command options.
Press Ctrl+C . I will press Ctrl C to exit the help details.
Press Control+Shift+K I will clear the screen.
Type plot sin(x) and press Enter. Enter the command plot space sin x with x in parenthesis.
Show the graph on the screen.

Close the graphics window.

Sin x versus x graph appears on the screen.

Close the graphics window.

Go to the terminal. Go to the terminal.
Cursor on the terminal. Next, let's make a postscript file for the sin x plot.
Type set term postscript landscape and press Enter . Type set space term space postscript space landscape.

This sets a postscript capable terminal in landscape orientation.

Type set output “sinx.ps” and press Enter. Next, type set space output space in double quotes sinx dot ps.
Hover mouse next to the command. This sets output in the user specified filename sinx dot ps.
Type plot sin(x) and press Enter. Enter command plot sin(x) to generate output to the file sinx.ps.

The output files are generated in the working directory.

Press Control+Shift+K I will clear the screen.
Type pwd and press Enter.

Hover mouse over the result.

Let's check the path of gnuplot.

Enter the command pwd.

The path shown here is Desktop directory.

Go to Desktop and show the sinx.ps file. Go to Desktop and notice the newly created file.
Open sinx.ps file. Double click on the icon to open and view the file.
Close sinx.ps and go back to gnuplot. We will close the output file and go back to gnuplot.
Press Control+Shift+K . I will clear the screen.

Let's save the output to a svg image file.

Type set term svg background “cyan” size 400,400

and press Enter.

For this, enter the command as shown here.

Type set space term space svg.

I will continue to add more specifications on the same line.

Hover mouse on the command at background “cyan” size 400,400 on the screen. I will set a cyan background for the plot.

I will also set the output image pixel size to be 400 by 400. `

Type set output “sinx.svg” and press Enter. Now, specify a file name for the plot.

Type the following command. set space output space in double quotes sinx dot svg.

Type show palette colornames and press Enter. The command, show palette colornames returns the color codes in gnuplot.
Hover mouse over the 3 column output. The output shows color name, corresponding hex code and the RGB code.

You may use this command to know more about color codes for different colors.

Press Ctrl+Alt+K. I will clear the screen.
Type plot sin(x) and press Enter. Enter the command, plot sin(x) to generate the svg image.
Go to Desktop and show sinx.svg file icon. Next, go to Desktop and notice the sinx.svg file that is generated.
Double click to open the first.svg file. Open the sinx.svg file.

View the square 400 by 400 pixel image of the graph.

The background has cyan color as specified.

Close the image file and go back to gnuplot. We will close the output file and go back to gnuplot.
Type save term “svg.term”

and press Enter.

We can save the terminal setting for future use.

Type save space term space in double quotes svg dot term.

Go to Desktop and show svg.term file icon. Let us go to the Desktop and notice the newly created svg dot term file.
Open svg.term file in text eidtor. I will open it in a text editor.
Show the opened svg.term file. This file will have the details of the color and size as we entered.
Close the image file and go back to gnuplot. We will close the output file and go back to gnuplot.
Type set term pop and press Enter. To reset the terminal setting to the default state, type the following command.

Enter the command, set space term space pop.

Cursor in the terminal. The reset command does not reset the terminal settings.
Press Control+Shift+K. Now, we are back on the interactive terminal.

I will clear the screen.

Type plot sin(x) . Enter the command plot space sinx with x in parenthesis.

Now, the plot is generated in the graphics window with the initial settings.

Close graphics window. Close the graphics window.

ASCII output can also be generated in gnuplot.

Type set term dumb and press Enter. At the prompt, enter the command, set space term space dumb.

ASCII code is uniform across all operating systems. Hence the files are portable across all operating systems.

Enter command plot sin(x) . Enter the command plot space sin x, with x in parenthesis.

This prints ASCII text art output results.

Show the ASCII output. I will zoom out the sin(x) plot on the screen.

The output, is seen on the terminal screen.

Notice the difference from the interactive terminal output.

Type q and press Enter . Enter the command q or quit to quit gnuplot.
Slide Number 6

Summary

Now let’s summarize. In this tutorial, we,
  • Learned about terminal types
  • Saved the output to different file types
  • Created customized outputs
  • Saved the terminal setting
  • Reset the terminal setting
Slide Number 7

Summary

  • Learned about dumb terminal command

and

  • Generated an ASCII output
Slide Number 8

Assignment 1

For assignment, plot the following functions,
  • Save cos(x) versus x plot in svg file format.
  • Change the background color and size in the output file.
Slide Number 9

Assignment 2

  • Set terminal to dumb.
  • Generate cos(x) versus x plot in ASCII format.
Show glimpse of the completed assignment. The completed assignment look similar to this.
Slide Number 10

About the Spoken Tutorial Project

This video summarises the Spoken Tutorial Project.

Please download and watch it.

Slide Number 11

Spoken Tutorial workshops

We conduct workshops and give certificates.

Please write to us.

Slide Number 12

Forum for Specific Questions

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

Acknowledgements

Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.
This is Rani from IIT, Bombay. Thank you for joining.

Contributors and Content Editors

Madhurig, Ranipv076, Snehalathak