summaryrefslogtreecommitdiff
path: root/day1/cheatsheet1.tex
blob: 583e098496a7d1bafdc12cf02617f3bf96d1bce4 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
\documentclass[12pt]{article}
\title{Interactive Plotting}
\author{FOSSEE}
\begin{document}
\maketitle

\section{Starting up...}
\begin{verbatim}
  $ ipython -pylab  
\end{verbatim}
Exiting Ipython
\begin{verbatim}     
  In [1]: print "Hello, World!"
  In [2]: ^D
  Do you really want to exit ([y]/n)? y
\end{verbatim}
Breaking out of loops
\begin{verbatim}     
  In [1]: while True:
    ...:     print "Hello, World!"
    ...:     
  Hello, World!
  Hello, World!^C
\end{verbatim}

\section{First Plot}
\begin{verbatim}
  In [2]: x=linspace(0, 2*pi, 50)

  In [3]: plot(x,sin(x))
  Out[3]: [<matplotlib.lines.Line2D object at 0xb6e5874c>]
\end{verbatim}

\section{Labeling}
\begin{verbatim}
  In [4]: xlabel('x')

  In [5]: ylabel('sin(x)')
\end{verbatim}

\section{Another example}
\begin{verbatim}
In [6]: clf()

In [7]: y = linspace(0,10,101)

In [8]: plot(y, exp(-y))

In [9]: xlabel('y')

In [10]: ylabel(r'$e^{-y}$')
\end{verbatim}

\end{document}