# HG changeset patch # User Shantanu # Date 1254577127 -19800 # Node ID adcc40e2bf70a32e63e61b493645507ed0e29e45 # Parent 1f9492506ba2305bf0cefd00171e963383fed249 Made changes in plotting section. diff -r 1f9492506ba2 -r adcc40e2bf70 day2/session1.tex --- a/day2/session1.tex Sat Oct 03 16:18:26 2009 +0530 +++ b/day2/session1.tex Sat Oct 03 19:08:47 2009 +0530 @@ -327,11 +327,12 @@ \begin{itemize} \item Also: PNG, PDF, PS, EPS, SVG, PDF \end{itemize} +\inctime{5} \end{frame} -\subsection{Plots - Lines, Labels and Legends} +\subsection{Plots - Lines, Labels} \begin{frame}[fragile] - \frametitle{Basic plotting \ldots} + \frametitle{Basic plotting} \begin{lstlisting} # Set properties of objects: >>> l, = plot(x, sin(x)) @@ -346,6 +347,26 @@ \end{frame} \begin{frame}[fragile] + \frametitle{Working with text \ldots} +%\begin{itemize} +% \item We already saw LaTeX markup support! +%\end{itemize} +\begin{lstlisting} +>>> w = arange(-2,2,.1) +>>> plot(w,exp(-(w*w))*cos) +>>> ylabel('$f(\omega)$') +>>> xlabel('$\omega$') +>>> title(r"$f(\omega)=e^{-\omega^2} + cos({\omega^2})$") +>>> annotate('maxima',xy=(0, 1), + xytext=(1, 0.8), + arrowprops=dict( + facecolor='black', + shrink=0.05)) +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] \frametitle{Multiple figures} \begin{lstlisting} @@ -360,48 +381,6 @@ \end{frame} \begin{frame}[fragile] - \frametitle{Legends and Annotation} -\begin{lstlisting} ->>> plot(x, cos(5*x), 'r--', - label='cosine') ->>> plot(x, sin(5*x), 'g--', - label='sine') ->>> legend() -# Or use: ->>> legend(['cosine', 'sine']) -# Annotation: ->>> text(1,0, '(1,0)') -\end{lstlisting} -\end{frame} - -\begin{frame}[fragile] - \frametitle{More commands \ldots} - \begin{lstlisting} -# semilog, loglog ->>> x = 10.**(-arange(100)*0.1) ->>> semilogx(x, x) ->>> semilogy(x, x) ->>> loglog(x, x) ->>> loglog(x, x*x) - \end{lstlisting} -\end{frame} - -\begin{frame}[fragile] - \frametitle{More plots \ldots} - \begin{lstlisting} ->>> clf() ->>> t = arange(0.1, 4, 0.1) ->>> s = exp(-t) ->>> e = 0.1*abs(randn(len(s))) ->>> errorbar(t, s, e) -# Scatter plots ->>> clf() ->>> t = randn(len(e)) ->>> scatter(t, e, c=s) - \end{lstlisting} -\end{frame} - -\begin{frame}[fragile] \frametitle{Note: \typ{pylab} in Python scripts} \begin{lstlisting} import pylab @@ -411,6 +390,7 @@ # Can also use: from pylab import linspace, sin, plot \end{lstlisting} +\inctime{5} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -708,6 +688,7 @@ \tiny For details see \url{http://matplotlib.sourceforge.net/screenshots/plotmap.py} \end{center} +\inctime{5} \end{frame} @@ -719,7 +700,6 @@ \item \url{http://matplotlib.sf.net/screenshots.html} \end{itemize} - \inctime{25} \end{frame} \begin{frame} @@ -766,6 +746,6 @@ \item Show rate of convergence for a first and second order finite difference of sin(x) \end{enumerate} -\inctime{30} +\inctime{20} \end{frame} \end{document}