Gnuplot/C2/Set-term-and-variations-in-output/English
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,
|
Slide Number 3
Learning Objectives |
and
|
Slide Number 4
System Requirements |
To record this tutorial, I am using
|
Slide Number 5
Pre-requisites |
To follow this tutorial,
|
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,
|
Slide Number 7
Summary |
and
|
Slide Number 8
Assignment 1 |
For assignment, plot the following functions,
|
Slide Number 9
Assignment 2 |
|
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. |