day1/cheatsheet1.tex
changeset 307 be62ebb11407
parent 295 39d7c4e14585
child 308 d93be08d69f8
equal deleted inserted replaced
306:57291186d598 307:be62ebb11407
    31 \end{lstlisting}
    31 \end{lstlisting}
    32 Exiting 
    32 Exiting 
    33 \begin{lstlisting}     
    33 \begin{lstlisting}     
    34 In [2]: (Ctrl-D)^D
    34 In [2]: (Ctrl-D)^D
    35 Do you really want to exit ([y]/n)? y
    35 Do you really want to exit ([y]/n)? y
    36 \end{lstlisting}
    36 \end{lstlisting} %$
    37 
    37 
    38 \section{Plotting}
    38 \section{Plotting}
    39 
    39 
       
    40 \subsection{Label}
       
    41 Pylab accepts TeX equation expressions in any text expression. To get something like:\\
       
    42 $\sigma_i=15$ \\
       
    43 on title of figure use: 
       
    44 \begin{lstlisting}
       
    45   title('$\sigma_i=15$')
       
    46 \end{lstlisting}  
       
    47 Same way one can have TeX expression on xlabel, ylabel etc.
       
    48 
       
    49 \subsection{legends}
       
    50 Apart from using \kwrd{loc='center'} for positioning the legend, one can also mention explicit co-ordinates for placement. 
       
    51 \begin{lstlisting}
       
    52 In []: legend(['sin(2y)'], loc=(.8,.1)) 
       
    53 \end{lstlisting}
       
    54 \typ{loc = 0, 1} (left top position of graph)\\
       
    55 \typ{loc = 0.5, 0.5} (center of graph).
       
    56 
       
    57 %\subsection{Multiple figures}
       
    58 
       
    59 \subsection{Saving figures}
       
    60 One can save figure in any of these formats: png, pdf, ps, eps and svg.
    40   \begin{lstlisting}
    61   \begin{lstlisting}
    41 In [1]: x = linspace(0, 2*pi, 50)
    62 In [1]: x = linspace(0, 2*pi, 50)
    42 In [2]: plot(x, sin(x))
    63 In [2]: plot(x, sin(x))
    43 In [3]: xlabel('x')
    64 In [3]: xlabel('x')
    44 In [4]: ylabel('sin(x)')
    65 In [4]: ylabel('sin(x)')