From f091abf11af72b135dd4f127dbe18e670ad7d223 Mon Sep 17 00:00:00 2001 From: Shantanu Date: Sat, 3 Oct 2009 19:39:49 +0530 Subject: Added legend() section. --- day2/session1.tex | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/day2/session1.tex b/day2/session1.tex index 0bdae0a..af5e7c2 100644 --- a/day2/session1.tex +++ b/day2/session1.tex @@ -330,7 +330,7 @@ array([[ 0.96276665, 0.77174861], \inctime{5} \end{frame} -\subsection{Plots - Lines, Labels} +\subsection{Plots - Lines, Labels, Legend} \begin{frame}[fragile] \frametitle{Basic plotting} \begin{lstlisting} @@ -366,6 +366,20 @@ array([[ 0.96276665, 0.77174861], \end{lstlisting} \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} @@ -683,7 +697,7 @@ title('triangular head; scale '\ \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} -- cgit