summaryrefslogtreecommitdiff
path: root/day1/cheatsheet2.tex
blob: 9416a41b6aae5e9f4571a08538daeeef50f07478 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
\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}