author | Puneeth Chaganti <punchagan@fossee.in> |
Fri, 06 Nov 2009 17:56:22 +0530 | |
changeset 287 | d4ad532525a2 |
parent 284 | 3c191accbb32 |
child 291 | ec70a2048871 |
child 295 | 39d7c4e14585 |
permissions | -rw-r--r-- |
284
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
1 |
\documentclass[12pt]{article} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
2 |
%\title{Plotting Data} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
3 |
%\author{FOSSEE} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
4 |
\begin{document} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
5 |
\date{} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
6 |
\vspace{-1in} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
7 |
\begin{center} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
8 |
\LARGE{Plotting Data}\\ |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
9 |
\large{FOSSEE} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
10 |
\end{center} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
11 |
\section{Scripts} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
12 |
IPython History |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
13 |
\begin{verbatim} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
14 |
In [1]: %hist |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
15 |
In [2]: %hist -n |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
16 |
\end{verbatim} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
17 |
|
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
18 |
Running a Script |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
19 |
\begin{verbatim} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
20 |
In [3]: %run script_name.py |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
21 |
\end{verbatim} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
22 |
|
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
23 |
\section{Plotting from Data files} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
24 |
\begin{verbatim} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
25 |
In [1]: L = [] #Empty List |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
26 |
In [2]: T = [] |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
27 |
In [3]: for line in open('pendulum.txt'): # Opening & Reading files |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
28 |
....: points = line.split() # Splitting a string |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
29 |
....: L.append(float(points[0])) # Appending to a list |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
30 |
....: T.append(float(points[1])) |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
31 |
In [4]: TSq = [] |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
32 |
In [5]: for t in T: #Iterating through lists |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
33 |
....: TSq.append(t*t) |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
34 |
In [6]: plot(L, TSq, '.') # Plotting points |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
35 |
\end{verbatim} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
36 |
\end{document} |
3c191accbb32
Added Cheatsheets for day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
37 |