added slides for other-type-of-plots.
--- a/other-type-of-plots/script.rst Tue Oct 12 14:30:53 2010 +0530
+++ b/other-type-of-plots/script.rst Tue Oct 12 16:26:36 2010 +0530
@@ -3,7 +3,7 @@
.. * scatter
.. * pie chart
.. * bar chart
-.. * log
+.. * loglog
.. * illustration of other plots, matplotlib help
===================
@@ -17,12 +17,12 @@
{{{ show the outline slide }}}
In this tutorial we will cover scatter plot, pie chart, bar chart and
-log plot. We will also see few other plots and also introduce you to
+loglog plot. We will also see few other plots and also introduce you to
the matplotlib help.
Let us start with scatter plot.
-{{{ switch to the next slide }}}
+{{{ switch to the next slide, scatter plot }}}
In a scatter plot, the data is displayed as a collection of points,
each having the value of one variable determining the position on the
@@ -55,12 +55,14 @@
{{{ close the file and switch to the terminal }}}
To produce the scatter plot first we need to load the data from the
-file using ``loadtxt``. We learned in one of the previous sessions,
+file using ``loadtxt``. We learned it in one of the previous sessions,
and it can be done as ::
year,profit =
loadtxt('/home/fossee/other-plot/company-a-data.txt',dtype=type(int()))
+{{{ switch to next slide, ``scatter`` function }}}
+
Now in-order to generate the scatter graph we will use the function
``scatter()``
::
@@ -75,9 +77,11 @@
problem to be tried out }}}
Now here is a question for you to try out, plot the same data with red
-diamonds.
+diamonds markers.
-**Clue** - *try scatter? in your ipython interpreter*
+.. **Clue** - *try scatter? in your ipython interpreter*
+
+Pause here and solve the question before moving on.
.. scatter(year,profit,color='r',marker='d')
@@ -95,6 +99,8 @@
the same data from file ``company-a-data.txt``. So let us reuse the
data we have loaded from the file previously.
+{{{ switch to next slide, ``pie()`` function }}}
+
We can plot the pie chart using the function ``pie()``.
::
@@ -111,7 +117,9 @@
same data with colors for each wedges as white, red, black, magenta,
yellow, blue, green, cyan, yellow, magenta and blue respectively.
-**Clue** - *try pie? in your ipython interpreter*
+.. **Clue** - *try pie? in your ipython interpreter*
+
+Pause here and solve the question before moving on.
.. pie(t,labels=s,colors=('w','r','k','m','y','b','g','c','y','m','b'))
@@ -121,7 +129,7 @@
with rectangular bars with lengths proportional to the values that
they represent.
-{{{ switch to the slide showing the problem statement of third
+{{{ switch to the slide showing the problem statement of fifth
exercise question }}}
Plot a bar chart representing the profit percentage of company A, with
@@ -129,6 +137,8 @@
So let us reuse the data we have loaded from the file previously.
+{{{ switch to the next slide, ``bar()`` function }}}
+
We can plot the bar chart using the function ``bar()``.
::
@@ -143,13 +153,14 @@
Now here is a question for you to try, plot a bar chart which is not
filled and which is hatched with 45\ :sup:`o` slanting lines as shown
-in the image in the slide.
+in the image in the slide. The data for the chart may be obtained from
+the file ``company-a-data.txt``.
-**Clue** - *try bar? in your ipython interpreter*
+.. **Clue** - *try bar? in your ipython interpreter*
.. bar(year,profit,fill=False,hatch='/')
-{{{ switch to the slide which says about bar chart }}}
+{{{ switch to the slide which says about log-log graph }}}
Now let us move on to log-log plot. A log-log graph or log-log plot is
a two-dimensional graph of numerical data that uses logarithmic scales
@@ -170,6 +181,8 @@
x = linspace(1,20,100)
y = 5*x**3
+{{{ switch to next slide, ``loglog()`` function }}}
+
Now we can plot the log-log chart using ``loglog()`` function,
::
@@ -200,7 +213,7 @@
matplotlib.sourceforge.net/users/screenshots.html and also at
matplotlib.sourceforge.net/gallery.html
-{{{ switch to recap slide }}}
+{{{ switch to summary slide }}}
Now we have come to the end of this tutorial. We have covered scatter
plot, pie chart, bar chart, log-log plot and also saw few other plots
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/other-type-of-plots/slides.org Tue Oct 12 16:26:36 2010 +0530
@@ -0,0 +1,137 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Other type of plots
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ - Scatter plot
+ - Pie chart
+ - Bar chart
+ - Log-log Plot
+ - ~matplotlib~ help
+* Exercise 1: Scatter plot
+ Plot a scatter plot showing the percentage profit of Company A from the year 2000
+ to 2010. The data for the same is available in the file ~company-a-data.txt~.
+* ~scatter()~ function
+ - /Syntax :/ scatter(x,y)
+ - x, a sequence of data
+ - y, a sequence of data, the same length of x
+ : In []: scatter(year, profit)
+* Exercise 2: Scatter plot
+ Plot a scatter plot of the same data in ~company-a-data.txt~ with red diamond markers.
+ :
+ *Clue* - /try scatter? in your ipython interpreter/
+* Pie chart
+ Pie chart - a circle graph divided into sectors, illustrating proportion.
+* Exercise 3: Pie chart
+ Plot a pie chart representing the profit percentage of company A, with the data
+ from the file ~company-a-data.txt~.
+ :
+ /(we can reuse the data in lists year and profit)/
+* ~pie()~ function
+ - /Syntax :/ pie(values, labels=labels)
+ - values, the data to be plotted
+ - labels, the label for each wedge in the pie chart
+ : In []: pie(profit, labels=year)
+* Exercise 4: Pie chart
+ Plot a pie chart with the same data with colors for each wedges as white, red,
+ magenta, yellow, blue, green, cyan, yellow, magenta, and blue.
+ :
+ *Clue* - /try pie? in your ipython interpreter/
+* Bar chart
+ Bar chart - a chart with rectangular bars with lengths proportional
+ to the values that they represent.
+* Exercise 5: Bar chart
+ Plot a bar chart representing the profit percentage of company A, with the data
+ from the file ~company-a-data.txt~.
+ :
+ /(we can reuse the data in lists year and profit)/
+* ~bar()~ function
+ - /Syntax :/ bar(x, y)
+ - x, a sequence of data
+ - y, a sequence of data, the same length of x
+ : In []: bar(year, profit)
+* Exercise 6: Bar chart
+ Plot a bar chart which is not filled and which is hatched with
+ #+begin_latex
+ $45^o$
+ #+end_latex
+ slanting lines as shown in the image. The data for the chart may be
+ obtained from the file ~company-a-data.txt~.
+ #+begin_latex
+ \begin{center}
+ \includegraphics[scale=0.3]{bar-chart-hatch}
+ \end{center}
+ #+end_latex
+ *Clue* - /try bar? in your ipython interpreter/
+* Log-log graph
+ - Log-log graph
+ - 2-dimensional graph.
+ - uses logarithmic scales on both axes.
+ - graph appears as straight line due to non-linear scaling.
+* Exercise 7:
+ Plot a log-log chart of
+ #+begin_latex
+ $y = 5x^3$
+ #+end_latex
+ for x from 1-20.
+* ~loglog()~ function
+ - /Syntax :/ loglog(x, y)
+ - x, a sequence of data
+ - y, a sequence of data, the same length of x
+ : In []: loglog(x, y)
+* Getting help on ~matplotlib~
+ - Help
+ - [[matplotlib.sourceforge.net/contents.html]]
+ - More plots
+ - [[matplotlib.sourceforge.net/users/screenshots.html]]
+ - [[matplotlib.sourceforge.net/gallery.html]]
+
+* Summary
+ - Scatter plot (~scatter()~)
+ - Pie chart (~pie()~)
+ - Bar chart (~bar()~)
+ - Log-log plot (~loglog()~)
+ - ~matplotlib~ online help
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/other-type-of-plots/slides.tex Tue Oct 12 16:26:36 2010 +0530
@@ -0,0 +1,280 @@
+% Created 2010-10-12 Tue 16:22
+\documentclass[presentation]{beamer}
+\usepackage[latin1]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{t1enc}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
+
+\title{Other type of plots}
+\author{FOSSEE}
+\date{}
+
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+\begin{document}
+
+\maketitle
+
+
+
+
+
+
+
+
+
+\begin{frame}
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item Scatter plot
+\item Pie chart
+\item Bar chart
+\item Log-log Plot
+\item \texttt{matplotlib} help
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Exercise 1: Scatter plot}
+\label{sec-2}
+
+ Plot a scatter plot showing the percentage profit of Company A from the year 2000
+ to 2010. The data for the same is available in the file \texttt{company-a-data.txt}.
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{\texttt{scatter()} function}
+\label{sec-3}
+
+\begin{itemize}
+\item \emph{Syntax :} scatter(x,y)
+
+\begin{itemize}
+\item x, a sequence of data
+\item y, a sequence of data, the same length of x
+\end{itemize}
+
+\end{itemize}
+
+\begin{verbatim}
+ In []: scatter(year, profit)
+\end{verbatim}
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Exercise 2: Scatter plot}
+\label{sec-4}
+
+ Plot a scatter plot of the same data in \texttt{company-a-data.txt} with red diamond markers.
+\begin{verbatim}
+
+\end{verbatim}
+
+ \textbf{Clue} - \emph{try scatter? in your ipython interpreter}
+\end{frame}
+\begin{frame}
+\frametitle{Pie chart}
+\label{sec-5}
+
+ Pie chart - a circle graph divided into sectors, illustrating proportion.
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Exercise 3: Pie chart}
+\label{sec-6}
+
+ Plot a pie chart representing the profit percentage of company A, with the data
+ from the file \texttt{company-a-data.txt}.
+\begin{verbatim}
+
+\end{verbatim}
+
+ \emph{(we can reuse the data in lists year and profit)}
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{\texttt{pie()} function}
+\label{sec-7}
+
+\begin{itemize}
+\item \emph{Syntax :} pie(values, labels=labels)
+
+\begin{itemize}
+\item values, the data to be plotted
+\item labels, the label for each wedge in the pie chart
+\end{itemize}
+
+\end{itemize}
+
+\begin{verbatim}
+ In []: pie(profit, labels=year)
+\end{verbatim}
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Exercise 4: Pie chart}
+\label{sec-8}
+
+ Plot a pie chart with the same data with colors for each wedges as white, red,
+ magenta, yellow, blue, green, cyan, yellow, magenta, and blue.
+\begin{verbatim}
+
+\end{verbatim}
+
+ \textbf{Clue} - \emph{try pie? in your ipython interpreter}
+\end{frame}
+\begin{frame}
+\frametitle{Bar chart}
+\label{sec-9}
+
+ Bar chart - a chart with rectangular bars with lengths proportional
+ to the values that they represent.
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Exercise 5: Bar chart}
+\label{sec-10}
+
+ Plot a bar chart representing the profit percentage of company A, with the data
+ from the file \texttt{company-a-data.txt}.
+\begin{verbatim}
+
+\end{verbatim}
+
+ \emph{(we can reuse the data in lists year and profit)}
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{\texttt{bar()} function}
+\label{sec-11}
+
+\begin{itemize}
+\item \emph{Syntax :} bar(x, y)
+
+\begin{itemize}
+\item x, a sequence of data
+\item y, a sequence of data, the same length of x
+\end{itemize}
+
+\end{itemize}
+
+\begin{verbatim}
+ In []: bar(year, profit)
+\end{verbatim}
+\end{frame}
+\begin{frame}
+\frametitle{Exercise 6: Bar chart}
+\label{sec-12}
+
+ Plot a bar chart which is not filled and which is hatched with
+ $45^o$
+ slanting lines as shown in the image. The data for the chart may be
+ obtained from the file \texttt{company-a-data.txt}.
+ \begin{center}
+ \includegraphics[scale=0.3]{bar-chart-hatch}
+ \end{center}
+ \textbf{Clue} - \emph{try bar? in your ipython interpreter}
+\end{frame}
+\begin{frame}
+\frametitle{Log-log graph}
+\label{sec-13}
+
+\begin{itemize}
+\item Log-log graph
+
+\begin{itemize}
+\item 2-dimensional graph.
+\item uses logarithmic scales on both axes.
+\item graph appears as straight line due to non-linear scaling.
+\end{itemize}
+
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Exercise 7:}
+\label{sec-14}
+
+ Plot a log-log chart of
+ $y = 5x^3$
+ for x from 1-20.
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{\texttt{loglog()} function}
+\label{sec-15}
+
+\begin{itemize}
+\item \emph{Syntax :} loglog(x, y)
+
+\begin{itemize}
+\item x, a sequence of data
+\item y, a sequence of data, the same length of x
+\end{itemize}
+
+\end{itemize}
+
+\begin{verbatim}
+ In []: loglog(x, y)
+\end{verbatim}
+\end{frame}
+\begin{frame}
+\frametitle{Getting help on \texttt{matplotlib}}
+\label{sec-16}
+
+\begin{itemize}
+\item Help
+
+\begin{itemize}
+\item \hyperref[sec-16]{matplotlib.sourceforge.net/contents.html}
+\end{itemize}
+
+\item More plots
+
+\begin{itemize}
+\item \hyperref[sec-16]{matplotlib.sourceforge.net/users/screenshots.html}
+\item \hyperref[sec-16]{matplotlib.sourceforge.net/gallery.html}
+\end{itemize}
+
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Summary}
+\label{sec-17}
+
+\begin{itemize}
+\item Scatter plot (\texttt{scatter()})
+\item Pie chart (\texttt{pie()})
+\item Bar chart (\texttt{bar()})
+\item Log-log plot (\texttt{loglog()})
+\item \texttt{matplotlib} online help
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-18}
+
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+\end{frame}
+
+\end{document}