day1/cheatsheet1.tex
changeset 107 647239f95c4a
child 264 c3a1de5b8216
equal deleted inserted replaced
105:ea8570f660b8 107:647239f95c4a
       
     1 \documentclass[12pt]{article}
       
     2 \title{Interactive Plotting}
       
     3 \author{FOSSEE}
       
     4 \begin{document}
       
     5 \maketitle
       
     6 
       
     7 \section{Starting up...}
       
     8 \begin{verbatim}
       
     9   $ ipython -pylab  
       
    10 \end{verbatim}
       
    11 Exiting Ipython
       
    12 \begin{verbatim}     
       
    13   In [1]: print "Hello, World!"
       
    14   In [2]: ^D
       
    15   Do you really want to exit ([y]/n)? y
       
    16 \end{verbatim}
       
    17 Breaking out of loops
       
    18 \begin{verbatim}     
       
    19   In [1]: while True:
       
    20     ...:     print "Hello, World!"
       
    21     ...:     
       
    22   Hello, World!
       
    23   Hello, World!^C
       
    24 \end{verbatim}
       
    25 
       
    26 \section{First Plot}
       
    27 \begin{verbatim}
       
    28   In [2]: x=linspace(0, 2*pi, 50)
       
    29 
       
    30   In [3]: plot(x,sin(x))
       
    31   Out[3]: [<matplotlib.lines.Line2D object at 0xb6e5874c>]
       
    32 \end{verbatim}
       
    33 
       
    34 \section{Labeling}
       
    35 \begin{verbatim}
       
    36   In [4]: xlabel('x')
       
    37 
       
    38   In [5]: ylabel('sin(x)')
       
    39 \end{verbatim}
       
    40 
       
    41 \section{Another example}
       
    42 \begin{verbatim}
       
    43 In [6]: clf()
       
    44 
       
    45 In [7]: y = linspace(0,10,101)
       
    46 
       
    47 In [8]: plot(y, exp(-y))
       
    48 
       
    49 In [9]: xlabel('y')
       
    50 
       
    51 In [10]: ylabel(r'$e^{-y}$')
       
    52 \end{verbatim}
       
    53 
       
    54 \end{document}
       
    55