day1/cheatsheet2.tex
author Santosh G. Vattam <vattam.santosh@gmail.com>
Fri, 06 Nov 2009 18:40:13 +0530
changeset 292 2622aebff64a
parent 291 ec70a2048871
child 300 f87f2a310abe
permissions -rw-r--r--
Branches merged.

\documentclass[12pt]{article}
%\title{Plotting Data}
%\author{FOSSEE}
\begin{document}
\date{}
\vspace{-1in}
\begin{center}
\LARGE{Plotting Data}\\
\large{FOSSEE}
\end{center}
\section{Plotting from Data files}
\begin{verbatim}
l = [] #Empty List
t = []
for line in open('pendulum.txt'): # Opening & Reading files
    points = line.split() # Splitting a string
    l.append(float(points[0])) # Appending to a list
    t.append(float(points[1]))
tsq = []
for time in t:  #Iterating through lists
    tsq.append(t*t)
plot(l, tsq, '.') # Plotting points
\end{verbatim}
\end{document}