other_types_of_plots/slides.tex
changeset 523 54bdda4aefa5
equal deleted inserted replaced
522:d33698326409 523:54bdda4aefa5
       
     1 % Created 2010-10-12 Tue 16:22
       
     2 \documentclass[presentation]{beamer}
       
     3 \usepackage[latin1]{inputenc}
       
     4 \usepackage[T1]{fontenc}
       
     5 \usepackage{fixltx2e}
       
     6 \usepackage{graphicx}
       
     7 \usepackage{longtable}
       
     8 \usepackage{float}
       
     9 \usepackage{wrapfig}
       
    10 \usepackage{soul}
       
    11 \usepackage{t1enc}
       
    12 \usepackage{textcomp}
       
    13 \usepackage{marvosym}
       
    14 \usepackage{wasysym}
       
    15 \usepackage{latexsym}
       
    16 \usepackage{amssymb}
       
    17 \usepackage{hyperref}
       
    18 \tolerance=1000
       
    19 \usepackage[english]{babel} \usepackage{ae,aecompl}
       
    20 \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
       
    21 \usepackage{listings}
       
    22 \lstset{language=Python, basicstyle=\ttfamily\bfseries,
       
    23 commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
       
    24 showstringspaces=false, keywordstyle=\color{blue}\bfseries}
       
    25 \providecommand{\alert}[1]{\textbf{#1}}
       
    26 
       
    27 \title{Other type of plots}
       
    28 \author{FOSSEE}
       
    29 \date{}
       
    30 
       
    31 \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
       
    32 \begin{document}
       
    33 
       
    34 \maketitle
       
    35 
       
    36 
       
    37 
       
    38 
       
    39 
       
    40 
       
    41 
       
    42 
       
    43 
       
    44 \begin{frame}
       
    45 \frametitle{Outline}
       
    46 \label{sec-1}
       
    47 
       
    48 \begin{itemize}
       
    49 \item Scatter plot
       
    50 \item Pie chart
       
    51 \item Bar chart
       
    52 \item Log-log Plot
       
    53 \item \texttt{matplotlib} help
       
    54 \end{itemize}
       
    55 \end{frame}
       
    56 \begin{frame}
       
    57 \frametitle{Exercise 1: Scatter plot}
       
    58 \label{sec-2}
       
    59 
       
    60   Plot a scatter plot showing the percentage profit of Company A from the year 2000
       
    61   to 2010. The data for the same is available in the file \texttt{company-a-data.txt}.
       
    62 \end{frame}
       
    63 \begin{frame}[fragile]
       
    64 \frametitle{\texttt{scatter()} function}
       
    65 \label{sec-3}
       
    66 
       
    67 \begin{itemize}
       
    68 \item \emph{Syntax :} scatter(x,y)
       
    69 
       
    70 \begin{itemize}
       
    71 \item x, a sequence of data
       
    72 \item y, a sequence of data, the same length of x
       
    73 \end{itemize}
       
    74 
       
    75 \end{itemize}
       
    76 
       
    77 \begin{verbatim}
       
    78    In []: scatter(year, profit)
       
    79 \end{verbatim}
       
    80 \end{frame}
       
    81 \begin{frame}[fragile]
       
    82 \frametitle{Exercise 2: Scatter plot}
       
    83 \label{sec-4}
       
    84 
       
    85   Plot a scatter plot of the same data in \texttt{company-a-data.txt} with red diamond markers.
       
    86 \begin{verbatim}
       
    87    
       
    88 \end{verbatim}
       
    89 
       
    90   \textbf{Clue} - \emph{try scatter? in your ipython interpreter}
       
    91 \end{frame}
       
    92 \begin{frame}
       
    93 \frametitle{Pie chart}
       
    94 \label{sec-5}
       
    95 
       
    96   Pie chart - a circle graph divided into sectors, illustrating proportion. 
       
    97 \end{frame}
       
    98 \begin{frame}[fragile]
       
    99 \frametitle{Exercise 3: Pie chart}
       
   100 \label{sec-6}
       
   101 
       
   102   Plot a pie chart representing the profit percentage of company A, with the data 
       
   103   from the file \texttt{company-a-data.txt}.
       
   104 \begin{verbatim}
       
   105    
       
   106 \end{verbatim}
       
   107 
       
   108   \emph{(we can reuse the data in lists year and profit)}
       
   109 \end{frame}
       
   110 \begin{frame}[fragile]
       
   111 \frametitle{\texttt{pie()} function}
       
   112 \label{sec-7}
       
   113 
       
   114 \begin{itemize}
       
   115 \item \emph{Syntax :} pie(values, labels=labels)
       
   116 
       
   117 \begin{itemize}
       
   118 \item values, the data to be plotted
       
   119 \item labels, the label for each wedge in the pie chart
       
   120 \end{itemize}
       
   121 
       
   122 \end{itemize}
       
   123 
       
   124 \begin{verbatim}
       
   125    In []: pie(profit, labels=year)
       
   126 \end{verbatim}
       
   127 \end{frame}
       
   128 \begin{frame}[fragile]
       
   129 \frametitle{Exercise 4: Pie chart}
       
   130 \label{sec-8}
       
   131 
       
   132   Plot a pie chart with the same data with colors for each wedges as white, red, 
       
   133   magenta, yellow, blue, green, cyan, yellow, magenta, and blue.
       
   134 \begin{verbatim}
       
   135    
       
   136 \end{verbatim}
       
   137 
       
   138   \textbf{Clue} - \emph{try pie? in your ipython interpreter}
       
   139 \end{frame}
       
   140 \begin{frame}
       
   141 \frametitle{Bar chart}
       
   142 \label{sec-9}
       
   143 
       
   144   Bar chart - a chart with rectangular bars with lengths proportional 
       
   145   to the values that they represent.
       
   146 \end{frame}
       
   147 \begin{frame}[fragile]
       
   148 \frametitle{Exercise 5: Bar chart}
       
   149 \label{sec-10}
       
   150 
       
   151   Plot a bar chart representing the profit percentage of company A, with the data 
       
   152   from the file \texttt{company-a-data.txt}.
       
   153 \begin{verbatim}
       
   154    
       
   155 \end{verbatim}
       
   156 
       
   157   \emph{(we can reuse the data in lists year and profit)}
       
   158 \end{frame}
       
   159 \begin{frame}[fragile]
       
   160 \frametitle{\texttt{bar()} function}
       
   161 \label{sec-11}
       
   162 
       
   163 \begin{itemize}
       
   164 \item \emph{Syntax :} bar(x, y)
       
   165 
       
   166 \begin{itemize}
       
   167 \item x, a sequence of data
       
   168 \item y, a sequence of data, the same length of x
       
   169 \end{itemize}
       
   170 
       
   171 \end{itemize}
       
   172 
       
   173 \begin{verbatim}
       
   174    In []: bar(year, profit)
       
   175 \end{verbatim}
       
   176 \end{frame}
       
   177 \begin{frame}
       
   178 \frametitle{Exercise 6: Bar chart}
       
   179 \label{sec-12}
       
   180 
       
   181   Plot a bar chart which is not filled and which is hatched with 
       
   182     $45^o$
       
   183   slanting lines as shown in the image. The data for the chart may be
       
   184   obtained from the file \texttt{company-a-data.txt}.
       
   185    \begin{center}
       
   186       \includegraphics[scale=0.3]{bar-chart-hatch}    
       
   187     \end{center}
       
   188   \textbf{Clue} - \emph{try bar? in your ipython interpreter}
       
   189 \end{frame}
       
   190 \begin{frame}
       
   191 \frametitle{Log-log graph}
       
   192 \label{sec-13}
       
   193 
       
   194 \begin{itemize}
       
   195 \item Log-log graph
       
   196 
       
   197 \begin{itemize}
       
   198 \item 2-dimensional graph.
       
   199 \item uses logarithmic scales on both axes.
       
   200 \item graph appears as straight line due to non-linear scaling.
       
   201 \end{itemize}
       
   202 
       
   203 \end{itemize}
       
   204 \end{frame}
       
   205 \begin{frame}
       
   206 \frametitle{Exercise 7:}
       
   207 \label{sec-14}
       
   208 
       
   209   Plot a log-log chart of 
       
   210     $y = 5x^3$
       
   211   for x from 1-20.
       
   212 \end{frame}
       
   213 \begin{frame}[fragile]
       
   214 \frametitle{\texttt{loglog()} function}
       
   215 \label{sec-15}
       
   216 
       
   217 \begin{itemize}
       
   218 \item \emph{Syntax :} loglog(x, y)
       
   219 
       
   220 \begin{itemize}
       
   221 \item x, a sequence of data
       
   222 \item y, a sequence of data, the same length of x
       
   223 \end{itemize}
       
   224 
       
   225 \end{itemize}
       
   226 
       
   227 \begin{verbatim}
       
   228    In []: loglog(x, y)
       
   229 \end{verbatim}
       
   230 \end{frame}
       
   231 \begin{frame}
       
   232 \frametitle{Getting help on \texttt{matplotlib}}
       
   233 \label{sec-16}
       
   234 
       
   235 \begin{itemize}
       
   236 \item Help
       
   237 
       
   238 \begin{itemize}
       
   239 \item \hyperref[sec-16]{matplotlib.sourceforge.net/contents.html}
       
   240 \end{itemize}
       
   241 
       
   242 \item More plots
       
   243 
       
   244 \begin{itemize}
       
   245 \item \hyperref[sec-16]{matplotlib.sourceforge.net/users/screenshots.html}
       
   246 \item \hyperref[sec-16]{matplotlib.sourceforge.net/gallery.html}
       
   247 \end{itemize}
       
   248 
       
   249 \end{itemize}
       
   250 \end{frame}
       
   251 \begin{frame}
       
   252 \frametitle{Summary}
       
   253 \label{sec-17}
       
   254 
       
   255 \begin{itemize}
       
   256 \item Scatter plot (\texttt{scatter()})
       
   257 \item Pie chart (\texttt{pie()})
       
   258 \item Bar chart (\texttt{bar()})
       
   259 \item Log-log plot (\texttt{loglog()})
       
   260 \item \texttt{matplotlib} online help
       
   261 \end{itemize}
       
   262 \end{frame}
       
   263 \begin{frame}
       
   264 \frametitle{Thank you!}
       
   265 \label{sec-18}
       
   266 
       
   267   \begin{block}{}
       
   268   \begin{center}
       
   269   This spoken tutorial has been produced by the
       
   270   \textcolor{blue}{FOSSEE} team, which is funded by the 
       
   271   \end{center}
       
   272   \begin{center}
       
   273     \textcolor{blue}{National Mission on Education through \\
       
   274       Information \& Communication Technology \\ 
       
   275       MHRD, Govt. of India}.
       
   276   \end{center}  
       
   277   \end{block}
       
   278 \end{frame}
       
   279 
       
   280 \end{document}