# HG changeset patch # User Shantanu # Date 1254578989 -19800 # Node ID 41bdf277c7557c1d33a328c0db1916ffb56270a2 # Parent adcc40e2bf70a32e63e61b493645507ed0e29e45 Added legend() section. diff -r adcc40e2bf70 -r 41bdf277c755 day2/session1.tex --- a/day2/session1.tex Sat Oct 03 19:08:47 2009 +0530 +++ b/day2/session1.tex Sat Oct 03 19:39:49 2009 +0530 @@ -330,7 +330,7 @@ \inctime{5} \end{frame} -\subsection{Plots - Lines, Labels} +\subsection{Plots - Lines, Labels, Legend} \begin{frame}[fragile] \frametitle{Basic plotting} \begin{lstlisting} @@ -367,6 +367,20 @@ \end{frame} \begin{frame}[fragile] + \frametitle{Legends} +\begin{lstlisting} +>>> x = linspace(0, 2*pi, 1000) +>>> plot(x, cos(5*x), 'r--', + label='cosine') +>>> plot(x, sin(5*x), 'g--', + label='sine') +>>> legend() +# Or use: +>>> legend(['cosine', 'sine']) +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] \frametitle{Multiple figures} \begin{lstlisting} @@ -683,7 +697,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}