\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}