# HG changeset patch # User Puneeth Chaganti # Date 1254579463 -19800 # Node ID 84c3f600045f0450a97355e69aed84c2a05f1eae # Parent 2281002b579b396b28252d2292a293a55185961d# Parent 41bdf277c7557c1d33a328c0db1916ffb56270a2 Merged Heads. diff -r 2281002b579b -r 84c3f600045f day2/session1.tex --- a/day2/session1.tex Sat Oct 03 19:39:06 2009 +0530 +++ b/day2/session1.tex Sat Oct 03 19:47:43 2009 +0530 @@ -222,7 +222,7 @@ exp(x), sqrt(x)} etc. \item \typ{sum(x, axis=0), product(x, axis=0), dot(a, bp)} \inctime{10} \end{itemize} - + \inctime{10} \end{frame} \subsection{Array Creation \& Slicing, Striding Arrays} @@ -331,7 +331,7 @@ \subsection{Plots - Lines, Labels and Legends} \begin{frame}[fragile] - \frametitle{Basic plotting \ldots} + \frametitle{Basic plotting} \begin{lstlisting} # Set properties of objects: >>> l, = plot(x, sin(x)) @@ -346,6 +346,42 @@ \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{Legends} +\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{Multiple figures} \begin{lstlisting} @@ -357,48 +393,7 @@ >>> title('Easy as 1,2,3') \end{lstlisting} -\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] @@ -703,7 +698,7 @@ \end{frame} \begin{frame}[fragile] \frametitle{Maps} - \includegraphics[height=2.5in, interpolate=true]{data/plotmap} + \includegraphics[height=2.3in, interpolate=true]{data/plotmap} \begin{center} \tiny For details see \url{http://matplotlib.sourceforge.net/screenshots/plotmap.py}