<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Python-3.4.3%2FC2%2FSaving-plots%2FEnglish-timed</id>
		<title>Python-3.4.3/C2/Saving-plots/English-timed - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Python-3.4.3%2FC2%2FSaving-plots%2FEnglish-timed"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python-3.4.3/C2/Saving-plots/English-timed&amp;action=history"/>
		<updated>2026-04-13T10:15:51Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Python-3.4.3/C2/Saving-plots/English-timed&amp;diff=47772&amp;oldid=prev</id>
		<title>Sandhya.np14 at 11:08, 12 June 2019</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python-3.4.3/C2/Saving-plots/English-timed&amp;diff=47772&amp;oldid=prev"/>
				<updated>2019-06-12T11:08:24Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 11:08, 12 June 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 188:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 188:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;'''saveplt()'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;'''saveplt()'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;2. '''savefig('sine.png')'''saves the '''plot''' in- &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;2. '''savefig('sine.png')''' saves the '''plot''' in-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;the '''root directory 'slash' (on GNU/Linux, Unix based systems), '&amp;lt;u&amp;gt;C&amp;lt;/u&amp;gt;:' (on windows)''',&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;the '''root directory 'slash' (on GNU/Linux, Unix based systems), '&amp;lt;u&amp;gt;C&amp;lt;/u&amp;gt;:' (on windows)''',&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sandhya.np14</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Python-3.4.3/C2/Saving-plots/English-timed&amp;diff=47771&amp;oldid=prev</id>
		<title>Sandhya.np14 at 11:07, 12 June 2019</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python-3.4.3/C2/Saving-plots/English-timed&amp;diff=47771&amp;oldid=prev"/>
				<updated>2019-06-12T11:07:05Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://script.spoken-tutorial.org/index.php?title=Python-3.4.3/C2/Saving-plots/English-timed&amp;amp;diff=47771&amp;amp;oldid=47599&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Sandhya.np14</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Python-3.4.3/C2/Saving-plots/English-timed&amp;diff=47599&amp;oldid=prev</id>
		<title>Pratik kamble: Created page with &quot; {| border=1 | '''Time''' | '''Narration'''  |- |00:01 | Hello Friends. Welcome to the tutorial on &quot;'''Saving Plots'''&quot;.   |- | 00:06 | At the end of this tutorial, you will b...&quot;</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python-3.4.3/C2/Saving-plots/English-timed&amp;diff=47599&amp;oldid=prev"/>
				<updated>2019-05-29T13:08:55Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot; {| border=1 | &amp;#039;&amp;#039;&amp;#039;Time&amp;#039;&amp;#039;&amp;#039; | &amp;#039;&amp;#039;&amp;#039;Narration&amp;#039;&amp;#039;&amp;#039;  |- |00:01 | Hello Friends. Welcome to the tutorial on &amp;quot;&amp;#039;&amp;#039;&amp;#039;Saving Plots&amp;#039;&amp;#039;&amp;#039;&amp;quot;.   |- | 00:06 | At the end of this tutorial, you will b...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
{| border=1&lt;br /&gt;
| '''Time'''&lt;br /&gt;
| '''Narration'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|00:01&lt;br /&gt;
| Hello Friends. Welcome to the tutorial on &amp;quot;'''Saving Plots'''&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:06&lt;br /&gt;
| At the end of this tutorial, you will be able to -&lt;br /&gt;
&lt;br /&gt;
Save plots using '''savefig() function'''.&lt;br /&gt;
&lt;br /&gt;
Save plots in different formats.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:15&lt;br /&gt;
|To record this tutorial, I am using &lt;br /&gt;
&lt;br /&gt;
'''Ubuntu Linux 14.04''' operating system&lt;br /&gt;
&lt;br /&gt;
'''Python 3.4.3'''&lt;br /&gt;
&lt;br /&gt;
'''IPython 5.1.0'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:28&lt;br /&gt;
| To practise this tutorial, you should know how to use '''Plot Command interactively.&lt;br /&gt;
&lt;br /&gt;
If not, see the prerequisite '''Python''' tutorials on this website.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:40&lt;br /&gt;
| Let us first open the '''Terminal '''by pressing '''Ctrl+Alt+T '''keys simultaneously. &lt;br /&gt;
Now, type '''ipython3''' and press '''Enter'''. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:54&lt;br /&gt;
| Let us initialise the '''pylab''' package.&lt;br /&gt;
Type '''percentage pylab '''and press''' Enter'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:05&lt;br /&gt;
| Let us plot a '''sine curve''' from''' minus 3 pi''' to '''3 pi. '''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:10&lt;br /&gt;
| First, we will calculate the required points for the plot. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:14&lt;br /&gt;
| To do this, type,&lt;br /&gt;
&lt;br /&gt;
'''x equals to linspace(minus 3 star pi comma 3 star pi comma 100) '''in the '''console'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:28&lt;br /&gt;
| Let us '''plot''' a '''sine curve''' for the points stored in '''variable x'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:33&lt;br /&gt;
| Type '''plot(x comma sin(x)) '''in the '''console''' and press '''Enter. '''&lt;br /&gt;
&lt;br /&gt;
Don't close the '''plot window''' for rest of the tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:47&lt;br /&gt;
| Here you can see we have made a very basic '''sine plot'''. Now let us see how to save the '''plot.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:54&lt;br /&gt;
| For saving the plot, we will use the '''savefig() function.''' &lt;br /&gt;
&lt;br /&gt;
Syntax: '''savefig(fname)'''&lt;br /&gt;
&lt;br /&gt;
'''savefig function''' takes one '''argument''' which is the filename. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:05&lt;br /&gt;
| Type '''savefig('sine.png') '''and press''' Enter'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:12&lt;br /&gt;
| This saves the file in '''present working directory'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:16&lt;br /&gt;
| The characters after the '''dot '''in the filename is the '''extension'''. It determines the format in which you want to save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:27&lt;br /&gt;
| To check current working directory, Type '''pwd '''in the '''console''' and press '''Enter'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:34&lt;br /&gt;
| To save the file in a different directory, type full path of the directory before the filename.&lt;br /&gt;
Type '''savefig('slash home slash fossee slash sine.png')'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:53&lt;br /&gt;
| Note that above''' file path '''is for''' Linux based file systems.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:59&lt;br /&gt;
| For''' Windows, '''give the entire file path as shown here. Here '''fossee''' is the '''username '''in''' Windows''' and '''sine.png '''file is to be saved on '''Desktop'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:15&lt;br /&gt;
| Here we have used an '''extension dot png.''' This will ensure that the image is saved as a '''PNG''' file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:24&lt;br /&gt;
| Now let us locate the file '''sine.png''' which we had saved earlier. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:30&lt;br /&gt;
| We have saved the file to &lt;br /&gt;
&lt;br /&gt;
'''(slash)home(slash)fossee,'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:35&lt;br /&gt;
| Let us navigate to '''(slash)home(slash)fossee''' using the file browser. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|03:40&lt;br /&gt;
| Open the '''sine.png '''file to see the plotted '''sine curve. '''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:46&lt;br /&gt;
| '''savefig''' can save the plot in many formats, such as&lt;br /&gt;
&lt;br /&gt;
'''pdf - portable document format, '''&lt;br /&gt;
&lt;br /&gt;
'''ps - post script, '''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:57&lt;br /&gt;
| '''eps - encapsulated post script, '''to be used with '''LaTeX '''documents&lt;br /&gt;
&lt;br /&gt;
'''svg - scalable vector graphics, '''&lt;br /&gt;
&lt;br /&gt;
'''png - portable network graphics '''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:10&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:16&lt;br /&gt;
| Save the '''sine plot''' in the '''eps format'''.  Let us see the output for this exercise.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:23&lt;br /&gt;
| Type '''savefig('slash home slash fossee slash sine.eps')''' and press '''Enter.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:35&lt;br /&gt;
| Now let us go to '''slash home slash fossee''' and see the new file created. We see the file '''sine.eps''' here.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:48&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
Save the '''sine plot''' in '''PDF, PS''' and '''SVG formats'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:00&lt;br /&gt;
| This brings us to the end of this tutorial. In this tutorial,we have learnt to,&lt;br /&gt;
&lt;br /&gt;
1. Save plots using the '''savefig() '''function.&lt;br /&gt;
&lt;br /&gt;
2. Save the plots in different formats like&lt;br /&gt;
''' pdf  - ps  - png  - svg  - eps'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:17&lt;br /&gt;
| Here are some assignment questions for you to solve.&lt;br /&gt;
&lt;br /&gt;
1. Which command is used to save a '''plot'''?&lt;br /&gt;
'''saveplot()'''&lt;br /&gt;
&lt;br /&gt;
'''savefig()'''&lt;br /&gt;
&lt;br /&gt;
'''savefigure()'''&lt;br /&gt;
&lt;br /&gt;
'''saveplt()'''&lt;br /&gt;
&lt;br /&gt;
2. '''savefig('sine.png')'''saves the '''plot''' in&lt;br /&gt;
&lt;br /&gt;
'''The root directory 'slash' (on GNU/Linux, Unix based systems), '&amp;lt;u&amp;gt;C&amp;lt;/u&amp;gt;:' (on windows)'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:40&lt;br /&gt;
|Will result in an '''error''' as '''full path''' is not supplied.&lt;br /&gt;
&lt;br /&gt;
The current '''working directory'''.&lt;br /&gt;
&lt;br /&gt;
Predefined directory like “'''slash '''documents.”&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:50&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
1. To save a plot, we use the '''savefig() function.'''&lt;br /&gt;
&lt;br /&gt;
2. If we save a file without complete path,  it gets saved in the current '''working directory'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:02&lt;br /&gt;
|Please post your timed questions in this forum.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:07&lt;br /&gt;
|Please post your general queries on Python in this forum.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:12&lt;br /&gt;
|FOSSEE team coordinates the TBC project.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:16&lt;br /&gt;
| Spoken Tutorial Project is funded by NMEICT, MHRD, Govt. of India. For more details, visit this website.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:25&lt;br /&gt;
| This is Prabhu from IIT Bombay (or FOSSEE, if you wish) signing off. Thank you.&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pratik kamble</name></author>	</entry>

	</feed>