day1/session1.tex
changeset 194 7288d3867df2
parent 184 9efa777af2e2
child 215 b69d0bdb136c
child 224 668f88f20218
equal deleted inserted replaced
193:a31b0e76c0fb 194:7288d3867df2
    70 %    postbreak = \space\dots
    70 %    postbreak = \space\dots
    71 % }
    71 % }
    72 
    72 
    73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    74 % Title page
    74 % Title page
    75 \title[]{Interactive Plotting}
    75 \title[Interactive Plotting]{Python for Science and Engg: Interactive Plotting}
    76 
    76 
    77 \author[FOSSEE] {FOSSEE}
    77 \author[FOSSEE] {FOSSEE}
    78 
    78 
    79 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
    79 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
    80 \date[] {31, October 2009\\Day 1, Session 1}
    80 \date[] {31, October 2009\\Day 1, Session 1}
   159 \begin{frame}[fragile]
   159 \begin{frame}[fragile]
   160 \frametitle{First Plot}
   160 \frametitle{First Plot}
   161 \begin{columns}
   161 \begin{columns}
   162     \column{0.25\textwidth}
   162     \column{0.25\textwidth}
   163     \hspace*{-0.5in}
   163     \hspace*{-0.5in}
   164   \includegraphics[height=2in, interpolate=true]{data/firstplot}  
   164   \includegraphics[height=2in, interpolate=true]{data/firstplot}
   165     \column{0.8\textwidth}
   165     \column{0.8\textwidth}
   166     \begin{block}{}
   166     \begin{block}{}
   167     \small
   167     \small
   168 \begin{lstlisting}
   168 \begin{lstlisting}
   169 In []: x = linspace(0, 2*pi, 51)
   169 In []: x = linspace(0, 2*pi, 51)
   175 \end{frame}
   175 \end{frame}
   176 
   176 
   177 
   177 
   178 \begin{frame}[fragile]
   178 \begin{frame}[fragile]
   179 \frametitle{Walkthrough}
   179 \frametitle{Walkthrough}
   180 \begin{block}{\typ{linspace(start, stop, num)} }
   180 \begin{block}{\typ{x = linspace(start, stop, num)} }
   181 returns \typ{num} evenly spaced points, in the interval [\typ{start}, \typ{stop}].
   181 returns \typ{num} evenly spaced points, in the interval [\typ{start}, \typ{stop}].
   182 \end{block}
   182 \end{block}
   183 \vspace*{.5in}
   183 \begin{lstlisting}
       
   184 x[0] = start
       
   185 x[num - 1] = end
       
   186 \end{lstlisting}
       
   187 \vspace*{.35in}
   184 \begin{block}{\typ{plot(x, y)}}
   188 \begin{block}{\typ{plot(x, y)}}
   185 plots \typ{x} and \typ{y} using default line style and color
   189 plots \typ{x} and \typ{y} using default line style and color
   186 \end{block}
   190 \end{block}
   187 \end{frame}
   191 \end{frame}
   188 
   192 
   219 In []: y = linspace(0, 2*pi, 51)
   223 In []: y = linspace(0, 2*pi, 51)
   220 In []: plot(y, sin(2*y))
   224 In []: plot(y, sin(2*y))
   221 In []: xlabel('y')
   225 In []: xlabel('y')
   222 In []: ylabel('sin(2y)')
   226 In []: ylabel('sin(2y)')
   223   \end{lstlisting}
   227   \end{lstlisting}
   224 \emphbar{By default plots would be overlayed!}
   228 \emphbar{By default plots would be overlaid!}
   225 \end{frame}
   229 \end{frame}
   226 
   230 
   227 \begin{frame}[fragile]
   231 \begin{frame}[fragile]
   228 \frametitle{Title and Legends}
   232 \frametitle{Title and Legends}
   229 \vspace*{-0.15in}
   233 \vspace*{-0.15in}
   241   \includegraphics[height=2in, interpolate=true]{data/legend}  
   245   \includegraphics[height=2in, interpolate=true]{data/legend}  
   242   \end{center}
   246   \end{center}
   243 \end{frame}
   247 \end{frame}
   244 
   248 
   245 \begin{frame}[fragile]
   249 \begin{frame}[fragile]
   246 \frametitle{Changing Legend Placement}
   250 \frametitle{Legend Placement}
       
   251 
       
   252 \begin{block}{}
       
   253     \small
       
   254 \begin{lstlisting}
       
   255 In []: legend(['sin(2y)'], loc='center')
       
   256 \end{lstlisting}
       
   257 \end{block}
       
   258 
   247 \begin{columns}
   259 \begin{columns}
   248     \column{0.6\textwidth}
   260     \column{0.6\textwidth}
   249 \begin{block}{}
       
   250     \small
       
   251 \begin{lstlisting}
       
   252 In []: legend(['sin(2y)'], 
       
   253          loc='center')
       
   254 \end{lstlisting}
       
   255     \small
       
   256 \end{block}
       
   257  \includegraphics[height=2in, interpolate=true]{data/position}  
   261  \includegraphics[height=2in, interpolate=true]{data/position}  
       
   262 \begin{lstlisting}
       
   263 'best', 'right', 'center'
       
   264 \end{lstlisting}
   258 \column{0.45\textwidth}
   265 \column{0.45\textwidth}
   259 \vspace{-0.2in}
   266 \vspace{-0.2in}
   260 \begin{lstlisting}
   267 \begin{lstlisting}
   261 Location String   
       
   262 ===============   
       
   263 'best'            
       
   264 'upper right'     
   268 'upper right'     
   265 'upper left'      
   269 'upper left'      
   266 'lower left'      
   270 'lower left'      
   267 'lower right'     
   271 'lower right'     
   268 'right'           
       
   269 'center left'     
   272 'center left'     
   270 'center right'    
   273 'center right'    
   271 'lower center'    
   274 'lower center'    
   272 'upper center'    
   275 'upper center'    
   273 'center'          
       
   274 \end{lstlisting}
   276 \end{lstlisting}
   275 \end{columns}
   277 \end{columns}
   276 \end{frame}
   278 \end{frame}
   277 
   279 
   278 \begin{frame}[fragile]
   280 \begin{frame}[fragile]
   279 \frametitle{For placing legend at $(x,y)$}
   281   \frametitle{For arbitrary location}
   280 \vspace*{-0.1in}
   282 \vspace*{-0.1in}
   281 \begin{lstlisting}
   283 \begin{lstlisting}
   282 In []: legend(['sin(2y)'], loc=(.8,.1)) 
   284 In []: legend(['sin(2y)'], loc=(.8,.1)) 
   283 #(x,y) is position of lower-left 
   285 # Specify south-east corner position
   284 #corner of legend box.
       
   285 \end{lstlisting}
   286 \end{lstlisting}
   286 %\vspace*{-0.2in}
   287 %\vspace*{-0.2in}
   287 \begin{center}
   288 \begin{center}
   288   \includegraphics[height=2in, interpolate=true]{data/loc}  
   289   \includegraphics[height=2in, interpolate=true]{data/loc}  
   289 \end{center}
   290 \end{center}
   297 In []: close()
   298 In []: close()
   298 \end{lstlisting}
   299 \end{lstlisting}
   299 \end{frame}
   300 \end{frame}
   300 
   301 
   301 \begin{frame}[fragile]
   302 \begin{frame}[fragile]
   302 \frametitle{Plotting seprate figures}
   303 \frametitle{Plotting separate figures}
   303 \begin{lstlisting}
   304 \begin{lstlisting}
   304 In []: figure(1)
   305 In []: figure(1)
   305 In []: plot(y, sin(y))
   306 In []: plot(y, sin(y))
   306 In []: figure(2)
   307 In []: figure(2)
   307 In []: plot(y, cos(y))
   308 In []: plot(y, cos(y))
   394 }
   395 }
   395 \end{frame}
   396 \end{frame}
   396 \begin{frame}
   397 \begin{frame}
   397   \frametitle{Things we have learned}
   398   \frametitle{Things we have learned}
   398   \begin{itemize}
   399   \begin{itemize}
   399   \item Creating plots.
   400   \item Creating simple plots.
   400   \item Handling labels and legends.
   401   \item Adding labels and legends.
   401   \item Changing properties of plot.
   402   \item Annotating plots.
       
   403   \item Changing the looks: size, linewidth
   402   \end{itemize}
   404   \end{itemize}
   403 \end{frame}
   405 \end{frame}
   404 \begin{frame}[fragile]
   406 \begin{frame}[fragile]
   405   \begin{center}
   407   \begin{center}
   406   End of Session-1\\
   408   End of Session-1\\