day1/cheatsheet1.tex
changeset 330 46533051b9d3
parent 328 4075482a9770
child 341 7ae88b9da553
equal deleted inserted replaced
329:0a6ab1d81491 330:46533051b9d3
    42 \typ{linspace} returns array of length \typ{num}, for which \typ{x[0] = start} and \typ{x[num-1] = stop} \\
    42 \typ{linspace} returns array of length \typ{num}, for which \typ{x[0] = start} and \typ{x[num-1] = stop} \\
    43 \emph{Please note indices of array starts from zero(0)}
    43 \emph{Please note indices of array starts from zero(0)}
    44 
    44 
    45 \subsection{plot}
    45 \subsection{plot}
    46 \typ{In []: plot(X, Y)}\\
    46 \typ{In []: plot(X, Y)}\\
    47 For given arrays of equal length(above case X and Y), \typ{plot} plots the correspoding *x* and *y* pairs taken from X and Y.
    47 For given arrays of equal length(above case X and Y), \typ{plot} plots the corresponding *x* and *y* pairs taken from X and Y.
    48 
    48 
    49 \subsection{Colors of plots}
    49 \subsection{Colors of plots}
    50 \typ{In []: plot(y, sin(y), 'g')}\\
    50 \typ{In []: plot(y, sin(y), 'g')}\\
    51 Plots graph with green color. Other options available are:
    51 Plots graph with green color. Other options available are:
    52 \begin{lstlisting}
    52 \begin{lstlisting}
    63 \typ{In []: plot(x, cos(x), 'r', linewidth=2)}\\
    63 \typ{In []: plot(x, cos(x), 'r', linewidth=2)}\\
    64 Plots the line with linewidth = 2
    64 Plots the line with linewidth = 2
    65 \subsection{label and title}
    65 \subsection{label and title}
    66 \typ{In []: xlabel('Length') #sets *x* axis label to Length}\\ 
    66 \typ{In []: xlabel('Length') #sets *x* axis label to Length}\\ 
    67 \typ{In []: ylabel('Time') #sets *y* axis label to Time.}\\
    67 \typ{In []: ylabel('Time') #sets *y* axis label to Time.}\\
    68 \typ{In []: title('Sinusoids') #sets title of plot}\\
    68 \typ{In []: title('Sinusoid') #sets title of plot}\\
    69 \\
    69 \\
    70 \textbf{Additionally}\\
    70 \textbf{Additionally}\\
    71 Pylab accepts TeX equation expressions in any text expression. To get something like:\\
    71 Pylab accepts TeX equation expressions in any text expression. To get something like:\\
    72 $\sigma_i=15$ \\
    72 $\sigma_i=15$ \\
    73 on title of figure use: 
    73 on title of figure use: 
    76 \end{lstlisting}  
    76 \end{lstlisting}  
    77 Same way one can have TeX expression on xlabel, ylabel etc.
    77 Same way one can have TeX expression on xlabel, ylabel etc.
    78 
    78 
    79 \subsection{legends}
    79 \subsection{legends}
    80 \typ{In []: legend('sin(x)',loc=center)} \\
    80 \typ{In []: legend('sin(x)',loc=center)} \\
    81 Placec a legend on the current plot at location *loc*.\\
    81 Place a legend on the current plot at location *loc*.\\
    82 Apart from \typ{center}, some other \typ{loc} which can be specified are:
    82 Apart from \typ{center}, some other \typ{loc} which can be specified are:
    83 \begin{lstlisting}
    83 \begin{lstlisting}
    84 'best'
    84 'best'
    85 'right'
    85 'right'
    86 'upper right'
    86 'upper right'