--- a/day1/exercise/kwfreq.py Tue Oct 27 10:59:11 2009 +0530
+++ b/day1/exercise/kwfreq.py Tue Oct 27 11:58:55 2009 +0530
@@ -1,5 +1,5 @@
import keyword
-f = open('/path/to/file')
+f = open('amicable.py')
freq = {}
for line in f:
@@ -7,8 +7,10 @@
for word in words:
key = word.strip(',.!;?()[]: ')
if keyword.iskeyword(key):
- value = freq[key]
- freq[key] = value + 1
+ if key in freq:
+ freq[key] += 1
+ else:
+ freq[key] = 1
print freq
--- a/day1/session1.tex Tue Oct 27 10:59:11 2009 +0530
+++ b/day1/session1.tex Tue Oct 27 11:58:55 2009 +0530
@@ -72,7 +72,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page
-\title[]{Interactive Plotting}
+\title[Interactive Plotting]{Python for Science and Engg: Interactive Plotting}
\author[FOSSEE] {FOSSEE}
@@ -177,10 +177,14 @@
\begin{frame}[fragile]
\frametitle{Walkthrough}
-\begin{block}{\typ{linspace(start, stop, num)} }
+\begin{block}{\typ{x = linspace(start, stop, num)} }
returns \typ{num} evenly spaced points, in the interval [\typ{start}, \typ{stop}].
\end{block}
-\vspace*{.5in}
+\begin{lstlisting}
+x[0] = start
+x[num - 1] = end
+\end{lstlisting}
+\vspace*{.35in}
\begin{block}{\typ{plot(x, y)}}
plots \typ{x} and \typ{y} using default line style and color
\end{block}
@@ -221,7 +225,7 @@
In []: xlabel('y')
In []: ylabel('sin(2y)')
\end{lstlisting}
-\emphbar{By default plots would be overlayed!}
+\emphbar{By default plots would be overlaid!}
\end{frame}
\begin{frame}[fragile]
@@ -243,45 +247,42 @@
\end{frame}
\begin{frame}[fragile]
-\frametitle{Changing Legend Placement}
-\begin{columns}
- \column{0.6\textwidth}
+\frametitle{Legend Placement}
+
\begin{block}{}
\small
\begin{lstlisting}
-In []: legend(['sin(2y)'],
- loc='center')
+In []: legend(['sin(2y)'], loc='center')
\end{lstlisting}
- \small
\end{block}
+
+\begin{columns}
+ \column{0.6\textwidth}
\includegraphics[height=2in, interpolate=true]{data/position}
+\begin{lstlisting}
+'best', 'right', 'center'
+\end{lstlisting}
\column{0.45\textwidth}
\vspace{-0.2in}
\begin{lstlisting}
-Location String
-===============
-'best'
'upper right'
'upper left'
'lower left'
'lower right'
-'right'
'center left'
'center right'
'lower center'
'upper center'
-'center'
\end{lstlisting}
\end{columns}
\end{frame}
\begin{frame}[fragile]
-\frametitle{For placing legend at $(x,y)$}
+ \frametitle{For arbitrary location}
\vspace*{-0.1in}
\begin{lstlisting}
In []: legend(['sin(2y)'], loc=(.8,.1))
-#(x,y) is position of lower-left
-#corner of legend box.
+# Specify south-east corner position
\end{lstlisting}
%\vspace*{-0.2in}
\begin{center}
@@ -396,9 +397,10 @@
\begin{frame}
\frametitle{Things we have learned}
\begin{itemize}
- \item Creating plots.
- \item Handling labels and legends.
- \item Changing properties of plot.
+ \item Creating simple plots.
+ \item Adding labels and legends.
+ \item Annotating plots.
+ \item Changing the looks: size, linewidth
\end{itemize}
\end{frame}
\begin{frame}[fragile]