added slides for savefig.
--- a/savefig/script.rst Mon Oct 11 15:55:59 2010 +0530
+++ b/savefig/script.rst Mon Oct 11 20:20:29 2010 +0530
@@ -9,8 +9,16 @@
Savefig
=======
-Hello and welcome to the tutorial. In this tutorial you will learn how
-to save plots using Python.
+{{{ Show the first slide }}}
+
+Hello and welcome to the tutorial saving plots.
+
+{{{ switch to next slide, outline slide }}}
+
+In this tutorial you will learn how to save plots using Python. And
+saving in different formats, and locating the file in the file system.
+
+{{{ switch to next slide, a sine wave}}}
Start your IPython interpreter with the command ::
@@ -38,9 +46,11 @@
the plot for future use so that you can embed the plot in your
reports.
+{{{ switch to next slide, savefig() }}}
+
{{{ Switch the focus to IPython interpreter window }}}
-For saving the plot, we will use savefig function, and it has to be
+For saving the plot, we will use ``savefig()`` function, and it has to be
done with the plot window open. The statement is, ::
savefig('/home/fossee/sine.png')
@@ -73,6 +83,8 @@
close it and return to IPython interpreter, make sure the plot window
is still open, also don't close the file browser window }}}
+{{{ switch to next slide, More on savefig() }}}
+
So in-order to save a plot, we use ``savefig`` function. ``savefig``
can save the plot in many formats, such as pdf - portable document
format, ps - post script, eps - encapsulated post script, svg -
@@ -81,15 +93,19 @@
.. #[[slide must give the extensions for the files - Anoop]]
+{{{ switch to next slide, exercise 1 }}}
+
Let us now try to save the plot in eps format. ``eps`` stands for
encapsulated post script, and it can be embedded in your latex
-documents.
+documents. Pause here and try to figure it out yourself.
{{{ Switch focus to the already open plot window }}}
We still have the sine plot with us, and now let us save the plot as
``sine.eps``.
+{{{ switch to next slide, solution 1 }}}
+
{{{ Switch focus to IPython interpreter }}}
Now, We will save the plot using the function ``savefig`` ::
@@ -105,10 +121,17 @@
Yes! the new file ``sine.eps`` is here.
+{{{ switch to next slide, exercise 2 }}}
+
Now you may try saving the same in pdf, ps, svg formats.
-Let us review what we have learned in this session! We have learned to
-save plots in different formats using the function ``savefig()``.
+{{{ Switch to summary slide }}}
+
+This brings us to the end of this tutorial, in this tutorial we
+learned to save plots using the function ``savefig()``. Saving the
+plots in different formats and locating the files in the file system.
+
+{{{ switch to Thank you slide }}}
Thank you!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/savefig/slides.org Mon Oct 11 20:20:29 2010 +0530
@@ -0,0 +1,99 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Savefig
+#+AUTHOR: FOSSEE
+#+EMAIL: info@fossee.in
+#+DATE: 2010-10-11 Mon
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ - Saving plots.
+ - Plotting in different formats.
+ - Locating the file in the file system.
+
+* Creating a basic plot
+ Plot a sine wave from -3pi to 3pi.
+ #+begin_src python
+ In []: x = linspace(-3*pi,3*pi,100)
+
+ In []: plot(x, sin(x))
+ #+end_src
+* savefig()
+** savefig() - to save plots
+ : syntax: savefig(fname)
+** example
+*** savefig('/home/fossee/sine.png')
+ - file sine.png saved to the folder /home/fossee
+ - .png - file type
+
+* More on savefig()
+** Recall
+ - .png - file type
+** File types supported
+*** .pdf - PDF(Portable Document Format)
+*** .ps - PS(Post Script)
+*** .eps - Encapsulated Post Script
+ ~to be used with~ LaTeX ~documents~
+*** .svg - Scalable Vector Graphics
+ ~vector graphics~
+*** .png - Portable Network Graphics
+ ~supports transparency~
+* Exercise 1
+ Save the sine plot in the format EPS which can be embedded in LaTeX documents.
+* Solution 1
+ #+begin_src python
+ savefig('/home/fossee/sine.eps')
+ #+end_src
+* Exercise 2
+ Save the sine plot in PDF, PS and SVG formats.
+
+* Summary
+ You should now be able to
+ - Use ~savefig()~ function
+ - Save plots in different formats
+ - PDF
+ - PS
+ - PNG
+ - SVG
+ - EPS
+ - Locating the files in file system.
+
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/savefig/slides.tex Mon Oct 11 20:20:29 2010 +0530
@@ -0,0 +1,185 @@
+% Created 2010-10-11 Mon 17:08
+\documentclass[presentation]{beamer}
+\usepackage[latin1]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{t1enc}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
+
+\title{Savefig}
+\author{FOSSEE}
+\date{2010-10-11 Mon}
+
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+\begin{document}
+
+\maketitle
+
+
+
+
+
+
+
+
+
+\begin{frame}
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item Saving plots.
+\item Plotting in different formats.
+\item Locating the file in the file system.
+\end{itemize}
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Creating a basic plot}
+\label{sec-2}
+
+ Plot a sine wave from -3pi to 3pi.
+\begin{verbatim}
+In []: x = linspace(-3*pi,3*pi,100)
+
+In []: plot(x, sin(x))
+\end{verbatim}
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{savefig()}
+\label{sec-3}
+\begin{itemize}
+
+\item savefig() - to save plots
+\label{sec-3_1}%
+\begin{verbatim}
+ syntax: savefig(fname)
+\end{verbatim}
+
+
+\item example
+\label{sec-3_2}%
+\begin{itemize}
+
+\item savefig('/home/fossee/sine.png')
+\label{sec-3_2_1}%
+\begin{itemize}
+\item file sine.png saved to the folder /home/fossee
+\item .png - file type
+\end{itemize}
+
+
+\end{itemize} % ends low level
+\end{itemize} % ends low level
+\end{frame}
+\begin{frame}
+\frametitle{More on savefig()}
+\label{sec-4}
+\begin{itemize}
+
+\item Recall
+\label{sec-4_1}%
+\begin{itemize}
+\item .png - file type
+\end{itemize}
+
+
+\item File types supported
+\label{sec-4_2}%
+\begin{itemize}
+
+\item .pdf - PDF(Portable Document Format)\\
+\label{sec-4_2_1}%
+\item .ps - PS(Post Script)\\
+\label{sec-4_2_2}%
+\item .eps - Encapsulated Post Script\\
+\label{sec-4_2_3}%
+\texttt{to be used with} \LaTeX{} \texttt{documents}
+
+\item .svg - Scalable Vector Graphics\\
+\label{sec-4_2_4}%
+\texttt{vector graphics}
+
+\item .png - Portable Network Graphics\\
+\label{sec-4_2_5}%
+\texttt{supports transparency}
+\end{itemize} % ends low level
+\end{itemize} % ends low level
+\end{frame}
+\begin{frame}
+\frametitle{Exercise 1}
+\label{sec-5}
+
+ Save the sine plot in the format EPS which can be embedded in \LaTeX{} documents.
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 1}
+\label{sec-6}
+
+\begin{verbatim}
+savefig('/home/fossee/sine.eps')
+\end{verbatim}
+\end{frame}
+\begin{frame}
+\frametitle{Exercise 2}
+\label{sec-7}
+
+ Save the sine plot in PDF, PS and SVG formats.
+\end{frame}
+\begin{frame}
+\frametitle{Summary}
+\label{sec-8}
+
+ You should now be able to
+\begin{itemize}
+\item Use \texttt{savefig()} function
+\item Save plots in different formats
+
+\begin{itemize}
+\item PDF
+\item PS
+\item PNG
+\item SVG
+\item EPS
+\end{itemize}
+
+\item Locating the files in file system.
+\end{itemize}
+
+
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-9}
+
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+\end{frame}
+
+\end{document}