author | Madhusudan.C.S <madhusudancs@gmail.com> |
Tue, 29 Dec 2009 19:02:01 +0530 | |
changeset 333 | 25b18b51be41 |
parent 295 | 39d7c4e14585 |
child 307 | be62ebb11407 |
permissions | -rwxr-xr-x |
107
647239f95c4a
Added rough draft of slides and cheatsheet for Interactive Plotting.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
1 |
\documentclass[12pt]{article} |
295
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
2 |
|
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
3 |
|
107
647239f95c4a
Added rough draft of slides and cheatsheet for Interactive Plotting.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
4 |
\title{Interactive Plotting} |
647239f95c4a
Added rough draft of slides and cheatsheet for Interactive Plotting.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
5 |
\author{FOSSEE} |
295
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
6 |
\usepackage{listings} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
7 |
\lstset{language=Python, |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
8 |
basicstyle=\ttfamily, |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
9 |
commentstyle=\itshape\bfseries |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
10 |
} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
11 |
\newcommand{\typ}[1]{\lstinline{#1}} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
12 |
\usepackage[english]{babel} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
13 |
\usepackage[latin1]{inputenc} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
14 |
\usepackage{times} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
15 |
\usepackage[T1]{fontenc} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
16 |
\usepackage{ae,aecompl} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
17 |
\usepackage{mathpazo,courier,euler} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
18 |
\usepackage[scaled=.95]{helvet} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
19 |
|
107
647239f95c4a
Added rough draft of slides and cheatsheet for Interactive Plotting.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
20 |
\begin{document} |
264
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
21 |
\date{} |
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
22 |
\vspace{-1in} |
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
23 |
\begin{center} |
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
24 |
\LARGE{Interactive Plotting}\\ |
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
25 |
\large{FOSSEE} |
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
26 |
\end{center} |
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
27 |
\section{Starting up...} |
107
647239f95c4a
Added rough draft of slides and cheatsheet for Interactive Plotting.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
28 |
|
295
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
29 |
\begin{lstlisting} |
107
647239f95c4a
Added rough draft of slides and cheatsheet for Interactive Plotting.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
30 |
$ ipython -pylab |
295
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
31 |
\end{lstlisting} |
264
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
32 |
Exiting |
295
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
33 |
\begin{lstlisting} |
264
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
34 |
In [2]: (Ctrl-D)^D |
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
35 |
Do you really want to exit ([y]/n)? y |
295
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
36 |
\end{lstlisting} |
107
647239f95c4a
Added rough draft of slides and cheatsheet for Interactive Plotting.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
37 |
|
264
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
38 |
\section{Plotting} |
295
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
39 |
|
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
40 |
\begin{lstlisting} |
264
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
41 |
In [1]: x = linspace(0, 2*pi, 50) |
295
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
42 |
In [2]: plot(x, sin(x)) |
264
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
43 |
In [3]: xlabel('x') |
c3a1de5b8216
Updated day1 session1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
107
diff
changeset
|
44 |
In [4]: ylabel('sin(x)') |
295
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
45 |
In [5]: title('Sinusoids') |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
46 |
In [6]: legend(['sin(y)']) |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
47 |
In [7]: legend(['sin(2y)'], loc = 'center') |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
48 |
# loc = 'upper right', 'upper left', 'lower left, 'lower right', 'center left', |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
49 |
# 'center right', 'lower center', 'upper center', 'best', 'right', 'center' |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
50 |
|
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
51 |
In [8]: legend(['sin(2y)'], loc = (.8, .1)) |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
52 |
|
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
53 |
In [9]: savefig('sin.png') # Save figure |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
54 |
In [10]: close() # Closes the figure |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
55 |
|
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
56 |
In [11]: clf() # Clears the Plot area |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
57 |
|
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
58 |
In [12]: plot(y, sin(y), 'g') |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
59 |
# Colors can be: 'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w' |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
60 |
|
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
61 |
In [13]: plot(y, cos(y), 'r', linewidth=2) |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
62 |
|
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
63 |
In [14]: legend(['x', '-x']) |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
64 |
In [15]: annotate('origin', xy=(0, 0)) |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
65 |
|
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
66 |
In [16]: xmin, xman = xlim() # Without arguments gets |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
67 |
In [17]: ymin, ymax = ylim() # values |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
68 |
|
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
69 |
In [18]: xlim(0, 2 * pi) # With values, sets the |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
70 |
In [19]: ylim(ymin - 0.2, ymax + 0.2) # specified values |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
71 |
\end{lstlisting} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
72 |
|
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
73 |
\section{Saving and running scripts} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
74 |
\begin{itemize} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
75 |
\item \typ{\%hist} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
76 |
\item \typ{\%save four\_plot.py 16 18-27} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
77 |
\item \typ{\%run -i four\_plot.py} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
78 |
\end{itemize} |
39d7c4e14585
Added all day 1 cheatsheets.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
264
diff
changeset
|
79 |
|
107
647239f95c4a
Added rough draft of slides and cheatsheet for Interactive Plotting.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
80 |
\end{document} |
647239f95c4a
Added rough draft of slides and cheatsheet for Interactive Plotting.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
81 |