Difference between revisions of "Gnuplot/C2/Set-term-and-variations-in-output/English"
(7 intermediate revisions by 3 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 15: | Line 17: | ||
* Generating a plot for printing and sharing | * Generating a plot for printing and sharing | ||
* Save the plot in '''postscript''' and '''svg image''' formats | * Save the plot in '''postscript''' and '''svg image''' formats | ||
− | * Save and reset the terminal setting | + | * Save and reset the '''terminal''' setting |
|- | |- | ||
|| '''Slide Number 3''' | || '''Slide Number 3''' | ||
+ | |||
'''Learning Objectives''' | '''Learning Objectives''' | ||
− | || | + | || |
* '''ASCII output''' command | * '''ASCII output''' command | ||
and | and | ||
Line 27: | Line 30: | ||
|- | |- | ||
|| '''Slide Number 4''' | || '''Slide Number 4''' | ||
− | '''System | + | |
+ | '''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 53: | Line 60: | ||
|- | |- | ||
|| Hover mouse next to '''term X11'''. | || Hover mouse next to '''term X11'''. | ||
− | || Notice, the terminal type is shown here as '''x11'''. | + | || Notice, the '''terminal''' type is shown here as '''x11'''. |
+ | |||
For some users '''qt''' or '''wxt terminal''' will be the default '''terminal'''. | For some users '''qt''' or '''wxt terminal''' will be the default '''terminal'''. | ||
Line 59: | Line 67: | ||
|| Cursor on the '''terminal'''. | || Cursor on the '''terminal'''. | ||
|| '''Gnuplot''' supports several types of terminals. | || '''Gnuplot''' supports several types of terminals. | ||
− | Let’s open the details about terminal types using the help documentation. | + | |
+ | Let’s open the details about '''terminal''' types using the help documentation. | ||
|- | |- | ||
Line 71: | Line 80: | ||
|- | |- | ||
|| Hover mouse over '''set terminal'''. | || Hover mouse over '''set terminal'''. | ||
− | | The help documentation for the '''terminal''' opens. | + | ||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. | || The '''set terminal''' command allows to set, the type of output to be generated. | ||
Line 80: | Line 89: | ||
|| Hover mouse over '''set output'''. | || Hover mouse over '''set output'''. | ||
|| This is commonly used together with '''set output''' command. | || This is commonly used together with '''set output''' command. | ||
+ | |||
This directs the output to a file or a device. | This directs the output to a file or a device. | ||
Line 87: | Line 97: | ||
Press '''Enter''' again. | Press '''Enter''' again. | ||
|| The prompt reads as, '''Press return for more'''. | || The prompt reads as, '''Press return for more'''. | ||
+ | |||
So, press '''Enter'''. | So, press '''Enter'''. | ||
− | Press '''Enter''' again, till you notice the terminal list on the screen. | + | |
+ | Press '''Enter''' again, till you notice the '''terminal''' list on the screen. | ||
|- | |- | ||
− | || Hover mouse on the terminals shown on the screen. | + | || Hover mouse on the '''terminals''' shown on the screen. |
− | || Nearly 40 types of terminals are supported by '''gnuplot'''. | + | || Nearly 40 types of '''terminals''' are supported by '''gnuplot'''. |
|- | |- | ||
Line 102: | Line 114: | ||
|| Hover mouse over '''postscript, pdf, svg'''. | || Hover mouse over '''postscript, pdf, svg'''. | ||
|| '''Postscript''' and '''svg''' terminals direct output to a file in their respective formats. | || '''Postscript''' and '''svg''' terminals direct output to a file in their respective formats. | ||
+ | |||
The output can be saved and edited by the user. | The output can be saved and edited by the user. | ||
Line 109: | Line 122: | ||
|- | |- | ||
− | || | + | || Cursor on the terminal. |
|| Next, we will explore the options for '''postscript terminal'''. | || Next, we will explore the options for '''postscript terminal'''. | ||
Line 122: | Line 135: | ||
|- | |- | ||
|| Type '''postscript''' and press '''Enter'''. | || Type '''postscript''' and press '''Enter'''. | ||
− | | I will type '''postscript''' in the subtopic of set term prompt and press '''Enter'''. | + | || I will type '''postscript''' in the subtopic of set term prompt and press '''Enter'''. |
|- | |- | ||
Line 154: | Line 167: | ||
|- | |- | ||
|| Press '''Control+Shift+K''' | || Press '''Control+Shift+K''' | ||
− | || I will clear the ''' | + | || I will clear the '''screen'''. |
|- | |- | ||
Line 168: | Line 181: | ||
|- | |- | ||
|| Go to the '''terminal'''. | || Go to the '''terminal'''. | ||
− | | Go to the '''terminal'''. | + | || Go to the '''terminal'''. |
|- | |- | ||
Line 177: | Line 190: | ||
|| Type '''set term postscript landscape''' and press '''Enter '''. | || Type '''set term postscript landscape''' and press '''Enter '''. | ||
|| Type '''set space term space postscript''' '''space landscape'''. | || Type '''set space term space postscript''' '''space landscape'''. | ||
+ | |||
This sets a '''postscript''' capable '''terminal''' in '''landscape''' orientation. | This sets a '''postscript''' capable '''terminal''' in '''landscape''' orientation. | ||
Line 188: | Line 202: | ||
|| Type '''plot sin(x)''' and press '''Enter'''. | || Type '''plot sin(x)''' and press '''Enter'''. | ||
|| Enter command '''plot sin(x)''' to generate output to the file '''sinx.ps'''. | || Enter command '''plot sin(x)''' to generate output to the file '''sinx.ps'''. | ||
+ | |||
The output files are generated in the working directory. | The output files are generated in the working directory. | ||
|- | |- | ||
|| Press '''Control+Shift+K''' | || Press '''Control+Shift+K''' | ||
− | || I will clear the ''' | + | || I will clear the '''screen'''. |
|- | |- | ||
Line 199: | Line 214: | ||
|| Let's check the path of '''gnuplot'''. | || Let's check the path of '''gnuplot'''. | ||
Enter the command '''pwd'''. | Enter the command '''pwd'''. | ||
+ | |||
The path shown here is '''Desktop''' directory. | The path shown here is '''Desktop''' directory. | ||
Line 222: | Line 238: | ||
and press '''Enter'''. | and press '''Enter'''. | ||
|| For this, enter the command as shown here. | || For this, enter the command as shown here. | ||
+ | |||
Type '''set space term space svg'''. | Type '''set space term space svg'''. | ||
+ | |||
I will continue to add more specifications on the same line. | I will continue to add more specifications on the same line. | ||
Line 228: | Line 246: | ||
|| Hover mouse on the command at '''background “cyan” size 400,400''' on the screen. | || 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 set a '''cyan''' background for the plot. | ||
− | I will also set the output image pixel size to be | + | |
+ | I will also set the output image pixel size to be 400 by 400. | ||
` | ` | ||
|- | |- | ||
|| Type '''set output “sinx.svg”''' and press '''Enter'''. | || Type '''set output “sinx.svg”''' and press '''Enter'''. | ||
|| Now, specify a file name for the plot. | || Now, specify a file name for the plot. | ||
+ | |||
Type the following command. | Type the following command. | ||
'''set space output space in double quotes sinx dot svg'''. | '''set space output space in double quotes sinx dot svg'''. | ||
Line 243: | Line 263: | ||
|| Hover mouse over the 3 column output. | || Hover mouse over the 3 column output. | ||
|| The output shows color name, corresponding '''hex code''' and the '''RGB code'''. | || 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. | You may use this command to know more about color codes for different colors. | ||
Line 260: | Line 281: | ||
|| Double click to open the '''first.svg''' file. | || Double click to open the '''first.svg''' file. | ||
|| Open the '''sinx.svg''' file. | || Open the '''sinx.svg''' file. | ||
+ | |||
View the square '''400''' by '''400''' '''pixel''' image of the graph. | View the square '''400''' by '''400''' '''pixel''' image of the graph. | ||
+ | |||
The '''background''' has cyan color as specified. | The '''background''' has cyan color as specified. | ||
Line 271: | Line 294: | ||
and press '''Enter'''. | and press '''Enter'''. | ||
|| We can save the '''terminal''' setting for future use. | || We can save the '''terminal''' setting for future use. | ||
+ | |||
Type '''save''' space '''term''' space in double quotes '''svg dot term'''. | Type '''save''' space '''term''' space in double quotes '''svg dot term'''. | ||
Line 292: | Line 316: | ||
|| Type '''set term pop''' and press '''Enter'''. | || Type '''set term pop''' and press '''Enter'''. | ||
|| To reset the terminal setting to the default state, type the following command. | || To reset the terminal setting to the default state, type the following command. | ||
+ | |||
Enter the command, '''set space term space pop'''. | Enter the command, '''set space term space pop'''. | ||
|- | |- | ||
− | || | + | || Cursor in the terminal. |
|| The reset command does not reset the '''terminal''' settings. | || The reset command does not reset the '''terminal''' settings. | ||
Line 306: | Line 331: | ||
|| Type '''plot sin(x) '''. | || Type '''plot sin(x) '''. | ||
|| Enter the command '''plot space sinx''' with '''x''' in parenthesis. | || Enter the command '''plot space sinx''' with '''x''' in parenthesis. | ||
+ | |||
Now, the plot is generated in the graphics window with the initial settings. | Now, the plot is generated in the graphics window with the initial settings. | ||
Line 316: | Line 342: | ||
|| Type '''set term dumb''' and press '''Enter'''. | || Type '''set term dumb''' and press '''Enter'''. | ||
|| At the prompt, enter the command, '''set space term space dumb'''. | || At the prompt, enter the command, '''set space term space dumb'''. | ||
+ | |||
'''ASCII''' code is uniform across all operating systems. | '''ASCII''' code is uniform across all operating systems. | ||
Hence the files are portable across all operating systems. | Hence the files are portable across all operating systems. | ||
Line 322: | Line 349: | ||
|| Enter command '''plot sin(x) '''. | || Enter command '''plot sin(x) '''. | ||
|| Enter the command '''plot space sin x''', with '''x''' in parenthesis. | || Enter the command '''plot space sin x''', with '''x''' in parenthesis. | ||
+ | |||
This prints '''ASCII''' text art output results. | This prints '''ASCII''' text art output results. | ||
Line 327: | Line 355: | ||
|| Show the '''ASCII''' output. | || Show the '''ASCII''' output. | ||
|| I will zoom out the sin(x) plot on the screen. | || I will zoom out the sin(x) plot on the screen. | ||
− | The output, is seen on the terminal screen. | + | |
+ | The output, is seen on the '''terminal''' screen. | ||
+ | |||
Notice the difference from the interactive '''terminal''' output. | Notice the difference from the interactive '''terminal''' output. | ||
Line 341: | Line 371: | ||
* Saved the output to different file types | * Saved the output to different file types | ||
* Created customized outputs | * Created customized outputs | ||
− | * 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 | + | |
+ | || '''Slide Number 8''' | ||
+ | |||
'''Assignment 1''' | '''Assignment 1''' | ||
|| For assignment, plot the following functions, | || For assignment, plot the following functions, | ||
Line 355: | Line 393: | ||
|- | |- | ||
− | || '''Slide Number | + | || '''Slide Number 9''' |
+ | |||
'''Assignment 2''' | '''Assignment 2''' | ||
− | || | + | || |
* 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 366: | Line 405: | ||
|- | |- | ||
− | || '''Slide Number | + | || '''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 | + | || '''Slide Number 11''' |
'''Spoken Tutorial workshops''' | '''Spoken Tutorial workshops''' | ||
|| We conduct workshops and give certificates. | || We conduct workshops and give certificates. | ||
Line 378: | Line 417: | ||
|- | |- | ||
− | || '''Slide Number | + | || '''Slide Number 12''' |
− | '''Forum for | + | '''Forum for Specific Questions''' |
|| Please Post your timed queries in the forum. | || Please Post your timed queries in the forum. | ||
|- | |- | ||
− | || '''Slide Number | + | || '''Slide Number 13''' |
− | ''' | + | '''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,
|
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. |