|
1 % Created 2010-10-11 Mon 17:08 |
|
2 \documentclass[presentation]{beamer} |
|
3 \usepackage[latin1]{inputenc} |
|
4 \usepackage[T1]{fontenc} |
|
5 \usepackage{fixltx2e} |
|
6 \usepackage{graphicx} |
|
7 \usepackage{longtable} |
|
8 \usepackage{float} |
|
9 \usepackage{wrapfig} |
|
10 \usepackage{soul} |
|
11 \usepackage{t1enc} |
|
12 \usepackage{textcomp} |
|
13 \usepackage{marvosym} |
|
14 \usepackage{wasysym} |
|
15 \usepackage{latexsym} |
|
16 \usepackage{amssymb} |
|
17 \usepackage{hyperref} |
|
18 \tolerance=1000 |
|
19 \usepackage[english]{babel} \usepackage{ae,aecompl} |
|
20 \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet} |
|
21 \usepackage{listings} |
|
22 \lstset{language=Python, basicstyle=\ttfamily\bfseries, |
|
23 commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, |
|
24 showstringspaces=false, keywordstyle=\color{blue}\bfseries} |
|
25 \providecommand{\alert}[1]{\textbf{#1}} |
|
26 |
|
27 \title{Savefig} |
|
28 \author{FOSSEE} |
|
29 \date{2010-10-11 Mon} |
|
30 |
|
31 \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} |
|
32 \begin{document} |
|
33 |
|
34 \maketitle |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 \begin{frame} |
|
45 \frametitle{Outline} |
|
46 \label{sec-1} |
|
47 |
|
48 \begin{itemize} |
|
49 \item Saving plots. |
|
50 \item Plotting in different formats. |
|
51 \item Locating the file in the file system. |
|
52 \end{itemize} |
|
53 \end{frame} |
|
54 \begin{frame}[fragile] |
|
55 \frametitle{Creating a basic plot} |
|
56 \label{sec-2} |
|
57 |
|
58 Plot a sine wave from -3pi to 3pi. |
|
59 \begin{verbatim} |
|
60 In []: x = linspace(-3*pi,3*pi,100) |
|
61 |
|
62 In []: plot(x, sin(x)) |
|
63 \end{verbatim} |
|
64 \end{frame} |
|
65 \begin{frame}[fragile] |
|
66 \frametitle{savefig()} |
|
67 \label{sec-3} |
|
68 \begin{itemize} |
|
69 |
|
70 \item savefig() - to save plots |
|
71 \label{sec-3_1}% |
|
72 \begin{verbatim} |
|
73 syntax: savefig(fname) |
|
74 \end{verbatim} |
|
75 |
|
76 |
|
77 \item example |
|
78 \label{sec-3_2}% |
|
79 \begin{itemize} |
|
80 |
|
81 \item savefig('/home/fossee/sine.png') |
|
82 \label{sec-3_2_1}% |
|
83 \begin{itemize} |
|
84 \item file sine.png saved to the folder /home/fossee |
|
85 \item .png - file type |
|
86 \end{itemize} |
|
87 |
|
88 |
|
89 \end{itemize} % ends low level |
|
90 \end{itemize} % ends low level |
|
91 \end{frame} |
|
92 \begin{frame} |
|
93 \frametitle{More on savefig()} |
|
94 \label{sec-4} |
|
95 \begin{itemize} |
|
96 |
|
97 \item Recall |
|
98 \label{sec-4_1}% |
|
99 \begin{itemize} |
|
100 \item .png - file type |
|
101 \end{itemize} |
|
102 |
|
103 |
|
104 \item File types supported |
|
105 \label{sec-4_2}% |
|
106 \begin{itemize} |
|
107 |
|
108 \item .pdf - PDF(Portable Document Format)\\ |
|
109 \label{sec-4_2_1}% |
|
110 \item .ps - PS(Post Script)\\ |
|
111 \label{sec-4_2_2}% |
|
112 \item .eps - Encapsulated Post Script\\ |
|
113 \label{sec-4_2_3}% |
|
114 \texttt{to be used with} \LaTeX{} \texttt{documents} |
|
115 |
|
116 \item .svg - Scalable Vector Graphics\\ |
|
117 \label{sec-4_2_4}% |
|
118 \texttt{vector graphics} |
|
119 |
|
120 \item .png - Portable Network Graphics\\ |
|
121 \label{sec-4_2_5}% |
|
122 \texttt{supports transparency} |
|
123 \end{itemize} % ends low level |
|
124 \end{itemize} % ends low level |
|
125 \end{frame} |
|
126 \begin{frame} |
|
127 \frametitle{Exercise 1} |
|
128 \label{sec-5} |
|
129 |
|
130 Save the sine plot in the format EPS which can be embedded in \LaTeX{} documents. |
|
131 \end{frame} |
|
132 \begin{frame}[fragile] |
|
133 \frametitle{Solution 1} |
|
134 \label{sec-6} |
|
135 |
|
136 \begin{verbatim} |
|
137 savefig('/home/fossee/sine.eps') |
|
138 \end{verbatim} |
|
139 \end{frame} |
|
140 \begin{frame} |
|
141 \frametitle{Exercise 2} |
|
142 \label{sec-7} |
|
143 |
|
144 Save the sine plot in PDF, PS and SVG formats. |
|
145 \end{frame} |
|
146 \begin{frame} |
|
147 \frametitle{Summary} |
|
148 \label{sec-8} |
|
149 |
|
150 You should now be able to |
|
151 \begin{itemize} |
|
152 \item Use \texttt{savefig()} function |
|
153 \item Save plots in different formats |
|
154 |
|
155 \begin{itemize} |
|
156 \item PDF |
|
157 \item PS |
|
158 \item PNG |
|
159 \item SVG |
|
160 \item EPS |
|
161 \end{itemize} |
|
162 |
|
163 \item Locating the files in file system. |
|
164 \end{itemize} |
|
165 |
|
166 |
|
167 \end{frame} |
|
168 \begin{frame} |
|
169 \frametitle{Thank you!} |
|
170 \label{sec-9} |
|
171 |
|
172 \begin{block}{} |
|
173 \begin{center} |
|
174 This spoken tutorial has been produced by the |
|
175 \textcolor{blue}{FOSSEE} team, which is funded by the |
|
176 \end{center} |
|
177 \begin{center} |
|
178 \textcolor{blue}{National Mission on Education through \\ |
|
179 Information \& Communication Technology \\ |
|
180 MHRD, Govt. of India}. |
|
181 \end{center} |
|
182 \end{block} |
|
183 \end{frame} |
|
184 |
|
185 \end{document} |