<?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%2FC2%2FSaving-plots%2FGujarati</id>
		<title>Python/C2/Saving-plots/Gujarati - 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%2FC2%2FSaving-plots%2FGujarati"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python/C2/Saving-plots/Gujarati&amp;action=history"/>
		<updated>2026-04-27T15:48: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/C2/Saving-plots/Gujarati&amp;diff=6790&amp;oldid=prev</id>
		<title>Jyotisolanki at 06:51, 29 October 2013</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python/C2/Saving-plots/Gujarati&amp;diff=6790&amp;oldid=prev"/>
				<updated>2013-10-29T06:51:44Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://script.spoken-tutorial.org/index.php?title=Python/C2/Saving-plots/Gujarati&amp;amp;diff=6790&amp;amp;oldid=6787&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Jyotisolanki</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Python/C2/Saving-plots/Gujarati&amp;diff=6787&amp;oldid=prev</id>
		<title>Jyotisolanki: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello and welcome to the tutorial on &quot;Saving plots&quot;.  |- | 0:04 | At the end of this tutorial, you will be able to,  # Save plots using…'</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python/C2/Saving-plots/Gujarati&amp;diff=6787&amp;oldid=prev"/>
				<updated>2013-10-29T05:21:00Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;{| border=1 !Timing !Narration |- | 0:00 | Hello and welcome to the tutorial on &amp;quot;Saving plots&amp;quot;.  |- | 0:04 | At the end of this tutorial, you will be able to,  # Save plots using…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello and welcome to the tutorial on &amp;quot;Saving plots&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:04&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;
# Save plots in different formats.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:13&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Using plot interactively&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:19&lt;br /&gt;
|Now, Start your IPython interpreter with the command ipython hyphen pylab&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:30&lt;br /&gt;
|As you know, it will start your IPython interpreter with the required python modules for plotting and saving your plots.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:36&lt;br /&gt;
| To start with, let us plot a sine wave from minus 3 pi to 3 pi.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:43&lt;br /&gt;
| Let us start by calculating the required points for the plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:45&lt;br /&gt;
| It can be done using linspace as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:51&lt;br /&gt;
|You can Type x = linspace within brackets minus 3 into pi comma 3 into pi comma 100 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:59&lt;br /&gt;
| We have stored the required points in x. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:03&lt;br /&gt;
|Now let us plot the points using the plot statement.So type plot (x,sinx)  &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:18&lt;br /&gt;
| Done!&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:19&lt;br /&gt;
| we have made a very basic sine plot, now let us see how to save the plot for future use so that you can embed the plot in your reports.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:32&lt;br /&gt;
| So saving the plot, we will use savefig() function. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:36&lt;br /&gt;
|For this we shall keep the plot window open alongside the terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:40&lt;br /&gt;
| The statement is savefig within brackets in single quotes slash home slash fossee slash sine dot png&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:52&lt;br /&gt;
| Notice that savefig function takes one argument which is the filename, the last 3 characters after the. in the filename is the extension and type of the file which determines the format in which you want to save.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:10&lt;br /&gt;
| Also, note that we gave the full path or the absolute path to which we want to save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:18&lt;br /&gt;
| Here we have used an extension dot png which means we want to save the image as a PNG file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:25&lt;br /&gt;
|Now let us locate the file sine dot png which we had saved a while ago.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:32&lt;br /&gt;
| We have saved the file to slash home slash fossee  so let us navigate to  slash home slash fossee  using thefile browser.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:49&lt;br /&gt;
| Yes, the file sine dot png  is here. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:52&lt;br /&gt;
|Let us open it and check.The file find out the png is here. Let us open it and check&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:57&lt;br /&gt;
| So in-order to save a plot  , we use savefig function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:05&lt;br /&gt;
| dot savefig can save the plot in many formats, such as pdf - portable document format, ps - post script, eps - encapsulated post script, svg - scalable vector graphics, png - portable network graphics which support transparency etc.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:24&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;
|3:29&lt;br /&gt;
|Save the sine plot in the EPS format which can be embedded in LaTeX documents.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:37&lt;br /&gt;
| We still have the sine plot with us,let us now save the plot as sine dot eps.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:49&lt;br /&gt;
| Now, We will save the plot using the function savefig, so you can type savefig within brackets in single quotes slash home slash fossee slash sine dot eps and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:04&lt;br /&gt;
| Now let us go to slash home slash fossee  and see the new file created.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:13&lt;br /&gt;
| Yes! the new file sine dot epsis here.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:18&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;
|4:23&lt;br /&gt;
|Save the sine plot in PDF, PS and SVG formats.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:31&lt;br /&gt;
| This brings us to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:34&lt;br /&gt;
|In this tutorial,we have learnt to, Save plots using the savefig() function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:38&lt;br /&gt;
| then Save the plots in different formats like - pdf - ps - png - svg - eps&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:45&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:48&lt;br /&gt;
|1. Which command is used to save a plot. saveplot() savefig() savefigure() saveplt()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:59&lt;br /&gt;
| 2. savefig('sine.png') saves the plot in,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:04&lt;br /&gt;
| The root directory  (on GNU/Linux, Unix based systems), c colon slash  (on windows).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:14&lt;br /&gt;
| The second option. Will result in an error as full path is not supplied.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:18&lt;br /&gt;
| The third one.The current working directory.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:21&lt;br /&gt;
| and final option is Predefined directory like /documents.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:26&lt;br /&gt;
| And now, the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:28&lt;br /&gt;
|1.To save a plot,we use the savefig() function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:33&lt;br /&gt;
|2. Whenever we save a file,it gets saved in the current working directory.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:38&lt;br /&gt;
| Hope you have enjoyed and found it useful.THanks&lt;/div&gt;</summary>
		<author><name>Jyotisolanki</name></author>	</entry>

	</feed>