# HG changeset patch # User Puneeth Chaganti # Date 1291281222 -19800 # Node ID 54bdda4aefa588e55b03a42c11c35687f1f4f112 # Parent d336983264095e4edf00a017071778bff46745f6 Renamed some LOs and other minor corrections. diff -r d33698326409 -r 54bdda4aefa5 basic_datatypes_and_operators/quickref.tex --- a/basic_datatypes_and_operators/quickref.tex Wed Dec 01 16:51:35 2010 +0530 +++ b/basic_datatypes_and_operators/quickref.tex Thu Dec 02 14:43:42 2010 +0530 @@ -1,8 +1,5 @@ -\documentclass{article} -\begin{Document} -\begin{center} \textbf{Basic DataType Quick Reference}\\ -\end{center} + Declaring an Integer:\\ {\ex \lstinline| b=9999999999999999999 |} @@ -46,4 +43,3 @@ Join lists to create strings:\\ {\ex \lstinline| ','.join['List','joined','on','commas'] |} -\end{Document} diff -r d33698326409 -r 54bdda4aefa5 manipulating_strings/quickref.tex --- a/manipulating_strings/quickref.tex Wed Dec 01 16:51:35 2010 +0530 +++ b/manipulating_strings/quickref.tex Thu Dec 02 14:43:42 2010 +0530 @@ -4,8 +4,8 @@ \lstinline|s = `Hello World'|\\ \lstinline|s[0:5]| gives \texttt{Hello}\\ -\lstinline|s[6:]| gives \textt{World}\\ -\lstinline|s[6::2]| gives \textt{Wrd}\\ +\lstinline|s[6:]| gives \texttt{World}\\ +\lstinline|s[6::2]| gives \texttt{Wrd}\\ \lstinline|s.replace('e', 'a')| returns a new string with all e's replaced by a. diff -r d33698326409 -r 54bdda4aefa5 multiple_plots/quickref.tex diff -r d33698326409 -r 54bdda4aefa5 other_type_of_plots/bar-chart-hatch.png Binary file other_type_of_plots/bar-chart-hatch.png has changed diff -r d33698326409 -r 54bdda4aefa5 other_type_of_plots/company-a-data.txt --- a/other_type_of_plots/company-a-data.txt Wed Dec 01 16:51:35 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -2.000000000000000000e+03 2.001000000000000000e+03 2.002000000000000000e+03 2.003000000000000000e+03 2.004000000000000000e+03 2.005000000000000000e+03 2.006000000000000000e+03 2.007000000000000000e+03 2.008000000000000000e+03 2.009000000000000000e+03 2.010000000000000000e+03 -2.300000000000000000e+01 5.500000000000000000e+01 3.200000000000000000e+01 6.500000000000000000e+01 8.800000000000000000e+01 5.000000000000000000e+00 1.400000000000000000e+01 6.700000000000000000e+01 2.300000000000000000e+01 2.300000000000000000e+01 1.200000000000000000e+01 diff -r d33698326409 -r 54bdda4aefa5 other_type_of_plots/questions.rst --- a/other_type_of_plots/questions.rst Wed Dec 01 16:51:35 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -Objective Questions -------------------- - -.. A mininum of 8 questions here (along with answers) - -1. What is a log-log chart? - - a. A straight line graph - #. A graph on the logarithmic scale - #. A graph on the logarithmic scale with different scales for x and - y axes - #. A graph in which x axis is represented in logarithmic scale. - -Answer: A graph on the logarithmic scale with different scales for x - and y axes - -2. We have two lists with us ``years`` and ``profit``, what statement - can be issued to plot a pie chart to plot the profit for each year, - and each wedge has to be labelled with the corresponding year. - -Answer: pie(profit, labels=years) - -3. We have two lists with us ``years`` and profit``, what statement - can be issued to plot a scatter plot of the data in blue colored - diamonds. ``years`` has to be plotted along x-axis. - -Answer: scatter(year,profit,color='blue',marker='d') - -4. ``scatter(x, y, color='blue', marker='d')`` and ``plot(x, y, - color='b', marker='d')`` does exactly the same. - - a. True - #. False - -Answer: False - -5. ``plot(x, y, 'bd')`` creates a scattered plot in blue color and - diamond markers? - - a. True - #. False - -Answer: True - -6. ``scatter(x, y, 'bd')`` creates a scatter plot in blue color with - diamond markers. - - a. True - #. False - -Answer: False - -7. What statement can be issued to generate a bar chart with 135\ - :sup:`o` hatched bar filled with white. - - a. bar(x, y, color='w', hatch='/') - #. bar(x, y, color='w', hatch='\\') - #. bar(x, y, color='w', hatch='\') - #. bar(x, y, color='w', hatch='|') - -Answer: bar(x, y, color='w', hatch='\\') - -8. What statement can be issued to generate a bar chart with vertical - line hatching. - - a. bar(x, y, color='w', hatch='/') - #. bar(x, y, fill=False, hatch='\\') - #. bar(x, y, fill=False, hatch='|') - #. bar(x, y, color='w', hatch='\') - -Answer: bar(x, y, fill=False, hatch='|') - -Larger Questions ----------------- - -.. A minimum of 2 questions here (along with answers) - -1. Plot a log-log chart of the equation y=4*x\ :sup:`2` + 3*x for x - from -50 to 50. - -2. Plot a bar chart which is filled with white color and which is - hatched with 135\ :sup:`o` slanting lines for the data given in the - `file(company A data) `_ which has years and - profit percentage for each year. - diff -r d33698326409 -r 54bdda4aefa5 other_type_of_plots/quickref.tex --- a/other_type_of_plots/quickref.tex Wed Dec 01 16:51:35 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -Creating scatter plot:\\ -{\ex \lstinline| scatter(x, y)|} - -Creating pie chart:\\ -{\ex \lstinline| pie(p, labels=l)|} - -Creating bar chart:\\ -{\ex \lstinline| bar(x, y)|} - -Creating log-log chart:\\ -{\ex \lstinline| loglog(x, y)|} diff -r d33698326409 -r 54bdda4aefa5 other_type_of_plots/script.rst --- a/other_type_of_plots/script.rst Wed Dec 01 16:51:35 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,264 +0,0 @@ -.. Objectives -.. ---------- - -.. At the end of this tutorial, you will be able to - -.. 1. Create scatter plot -.. #. Create pie charts -.. #. Create bar charts -.. #. Create log-log plots. - -.. Prerequisites -.. ------------- - -.. 1. should have ``ipython`` and ``pylab`` installed. -.. #. getting started with ``ipython``. -.. #. loading data from files -.. #. plotting the data - - -.. Author : Anoop Jacob Thomas - Internal Reviewer : Puneeth - External Reviewer : - Language Reviewer : Bhanukiran - Checklist OK? : <10-11-2010, Anand, OK> [2010-10-05] - -.. #[Puneeth: Quickref missing] - -=================== -Other type of plots -=================== - -{{{ show the first slide }}} - -Hello and welcome to the tutorial ``The other kinds of plots``. - -.. #[Puneeth: this sentence doesn't read well] - -{{{ show the outline slide }}} - -.. #[Puneeth: motivate looking at other plots. Why are we looking at -.. them? Tell that we have only looked at one type of plot all the -.. while, etc.] - -Till now we have seen only one kind of plotting, and in this tutorial we -are going to see more kinds of plots such as the scatter plot, the pie chart, the bar chart and -the log-log plot. This tutorial covers the making of other kinds of -plots and also gives an introduction to matplotlib help. - -.. #[Puneeth: cover, see and introduce you. be consistent. does, the -.. "We" include the viewer or not?] - -Let us start with scatter plot. - -{{{ 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 -horizontal axis and the value of the other variable determining the -position on the vertical axis. This kind of plot is also called a -scatter chart, a scatter diagram or a scatter graph. - -Before we proceed further, start your IPython interpreter -:: - - ipython -pylab - -{{{ open the ipython interpreter in the terminal using the command -ipython -pylab }}} - -{{{ switch to the next slide having the problem statement of first -exercise }}} - -Now, let us plot a scatter plot showing the percentage profit of -a company A from the year 2000-2010. The data for the same is available -in the file ``company-a-data.txt``. - -{{{ open the file company-a-data.txt and show the content }}} - -The data file has two lines with a set of values in each line, the -first line representing years and the second line representing the -profit percentages. - -{{{ close the file and switch to the terminal }}} - -To produce the scatter plot, we first need to load the data from the -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())) - -By default loadtxt converts the value to float. The -``dtype=type(int())`` argument in loadtxt converts the value to -integer as we require the data as integer further in the tutorial. - -.. #[Puneeth: make a remark about dtype, that has not been covered in -.. the loadtxt tutorial.] - -{{{ switch to next slide, ``scatter`` function }}} - -Now in-order to generate the scatter graph we will use the function -``scatter()`` -:: - - scatter(year,profit) - -Notice that we passed two arguments to ``scatter()`` function, first -one the values in x-coordinate, year, and the other the values in -y-coordinate, the profit percentage. - -{{{ switch to the next slide which has the problem statement of -problem to be tried out }}} - -Now here is a question for you to try out, plot the same data with red -diamonds markers. - -.. **Clue** - *try scatter? in your ipython interpreter* - -Pause here and solve the question before moving on. - -.. scatter(year,profit,color='r',marker='d') - -Now let us see another kind of plot, the pie chart, for the same data. - -.. #[Puneeth: instead of just saying that, say that let's plot a pie -.. chart for the same data. continuity, will be good.] - -{{{ switch to the slide which says about pie chart }}} - -A pie chart or a circle graph is a circular chart divided into -sectors, illustrating proportion. - -{{{ switch to the slide showing the problem statement of second -exercise question }}} - -Plot a pie chart representing the profit percentage of company A, with -the same data from file ``company-a-data.txt``. So let us reuse the -data we have loaded from the file previously. - -.. #[Puneeth, this part can be move above.] - -{{{ switch to next slide, ``pie()`` function }}} - -We can plot the pie chart using the function ``pie()``. -:: - - pie(profit,labels=year) - -Notice that we passed two arguments to the function ``pie()``. First -one the values and the next one the set of labels to be used in the -pie chart. - -{{{ switch to the next slide which has the problem statement of -problem to be tried out }}} - -Now here is a question for you to try out, plot a pie chart with the -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* - -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')) - -{{{ switch to the slide which says about bar chart }}} - -Now let us move on to the bar charts. A bar chart or bar graph is a chart -with rectangular bars with lengths proportional to the values that -they represent. - -{{{ switch to the slide showing the problem statement of fifth -exercise question }}} - -Plot a bar chart representing the profit percentage of company A, with -the same data from file ``company-a-data.txt``. - -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()``. -:: - - bar(year,profit) - -Note that the function ``bar()`` needs at least two arguments one the -values in x-coordinate and the other values in y-coordinate which is -used to determine the height of the bars. - -{{{ switch to the next slide which has the problem statement of -problem to be tried out }}} - -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. The data for the chart may be obtained from -the file ``company-a-data.txt``. - -.. **Clue** - *try bar? in your ipython interpreter* - -.. bar(year,profit,fill=False,hatch='/') - -{{{ switch to the slide which says about log-log graph }}} - -Now let us move on to the log-log plot. A log-log graph or a log-log plot is -a two-dimensional graph of numerical data that uses logarithmic scales -on both the horizontal and vertical axes. Because of the nonlinear -scaling of the axes, a function of the form y = ax\ :sup:`b` will -appear as a straight line on a log-log graph - -{{{ switch to the slide showing the problem statement of fourth -exercise question }}} - - -Plot a `log-log` chart of y=5*x\ :sup:`3` for x from 1-20. - -Before we actually plot let us calculate the points needed for -that. -:: - - 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, -:: - - loglog(x,y) - -To understand the difference between a normal ``plot`` and a ``log-log -plot`` let us create another plot using the function ``plot``. -:: - - figure(2) - plot(x,y) - -{{{ show both the plots side by side }}} - -So that was ``log-log() plot``. - -{{{ switch to the next slide which says: "How to get help on -matplotlib online"}}} - -Now we will see few more plots and also see how to access help of -matplotlib over the internet. - -Help about matplotlib can be obtained from -matplotlib.sourceforge.net/contents.html - - -More plots can be seen at -matplotlib.sourceforge.net/users/screenshots.html and also at -matplotlib.sourceforge.net/gallery.html - -{{{ 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 -and covered how to access the matplotlib online help. - -{{{ switch to the thank you slide }}} - -Thank you! diff -r d33698326409 -r 54bdda4aefa5 other_type_of_plots/slides.org --- a/other_type_of_plots/slides.org Wed Dec 01 16:51:35 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -#+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 - - diff -r d33698326409 -r 54bdda4aefa5 other_type_of_plots/slides.tex --- a/other_type_of_plots/slides.tex Wed Dec 01 16:51:35 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,280 +0,0 @@ -% 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} diff -r d33698326409 -r 54bdda4aefa5 other_types_of_plots/bar-chart-hatch.png Binary file other_types_of_plots/bar-chart-hatch.png has changed diff -r d33698326409 -r 54bdda4aefa5 other_types_of_plots/company-a-data.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/other_types_of_plots/company-a-data.txt Thu Dec 02 14:43:42 2010 +0530 @@ -0,0 +1,2 @@ +2.000000000000000000e+03 2.001000000000000000e+03 2.002000000000000000e+03 2.003000000000000000e+03 2.004000000000000000e+03 2.005000000000000000e+03 2.006000000000000000e+03 2.007000000000000000e+03 2.008000000000000000e+03 2.009000000000000000e+03 2.010000000000000000e+03 +2.300000000000000000e+01 5.500000000000000000e+01 3.200000000000000000e+01 6.500000000000000000e+01 8.800000000000000000e+01 5.000000000000000000e+00 1.400000000000000000e+01 6.700000000000000000e+01 2.300000000000000000e+01 2.300000000000000000e+01 1.200000000000000000e+01 diff -r d33698326409 -r 54bdda4aefa5 other_types_of_plots/questions.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/other_types_of_plots/questions.rst Thu Dec 02 14:43:42 2010 +0530 @@ -0,0 +1,85 @@ +Objective Questions +------------------- + +.. A mininum of 8 questions here (along with answers) + +1. What is a log-log chart? + + a. A straight line graph + #. A graph on the logarithmic scale + #. A graph on the logarithmic scale with different scales for x and + y axes + #. A graph in which x axis is represented in logarithmic scale. + +Answer: A graph on the logarithmic scale with different scales for x + and y axes + +2. We have two lists with us ``years`` and ``profit``, what statement + can be issued to plot a pie chart to plot the profit for each year, + and each wedge has to be labelled with the corresponding year. + +Answer: pie(profit, labels=years) + +3. We have two lists with us ``years`` and profit``, what statement + can be issued to plot a scatter plot of the data in blue colored + diamonds. ``years`` has to be plotted along x-axis. + +Answer: scatter(year,profit,color='blue',marker='d') + +4. ``scatter(x, y, color='blue', marker='d')`` and ``plot(x, y, + color='b', marker='d')`` does exactly the same. + + a. True + #. False + +Answer: False + +5. ``plot(x, y, 'bd')`` creates a scattered plot in blue color and + diamond markers? + + a. True + #. False + +Answer: True + +6. ``scatter(x, y, 'bd')`` creates a scatter plot in blue color with + diamond markers. + + a. True + #. False + +Answer: False + +7. What statement can be issued to generate a bar chart with 135\ + :sup:`o` hatched bar filled with white. + + a. bar(x, y, color='w', hatch='/') + #. bar(x, y, color='w', hatch='\\') + #. bar(x, y, color='w', hatch='\') + #. bar(x, y, color='w', hatch='|') + +Answer: bar(x, y, color='w', hatch='\\') + +8. What statement can be issued to generate a bar chart with vertical + line hatching. + + a. bar(x, y, color='w', hatch='/') + #. bar(x, y, fill=False, hatch='\\') + #. bar(x, y, fill=False, hatch='|') + #. bar(x, y, color='w', hatch='\') + +Answer: bar(x, y, fill=False, hatch='|') + +Larger Questions +---------------- + +.. A minimum of 2 questions here (along with answers) + +1. Plot a log-log chart of the equation y=4*x\ :sup:`2` + 3*x for x + from -50 to 50. + +2. Plot a bar chart which is filled with white color and which is + hatched with 135\ :sup:`o` slanting lines for the data given in the + `file(company A data) `_ which has years and + profit percentage for each year. + diff -r d33698326409 -r 54bdda4aefa5 other_types_of_plots/quickref.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/other_types_of_plots/quickref.tex Thu Dec 02 14:43:42 2010 +0530 @@ -0,0 +1,11 @@ +Creating scatter plot:\\ +{\ex \lstinline| scatter(x, y)|} + +Creating pie chart:\\ +{\ex \lstinline| pie(p, labels=l)|} + +Creating bar chart:\\ +{\ex \lstinline| bar(x, y)|} + +Creating log-log chart:\\ +{\ex \lstinline| loglog(x, y)|} diff -r d33698326409 -r 54bdda4aefa5 other_types_of_plots/script.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/other_types_of_plots/script.rst Thu Dec 02 14:43:42 2010 +0530 @@ -0,0 +1,264 @@ +.. Objectives +.. ---------- + +.. At the end of this tutorial, you will be able to + +.. 1. Create scatter plot +.. #. Create pie charts +.. #. Create bar charts +.. #. Create log-log plots. + +.. Prerequisites +.. ------------- + +.. 1. should have ``ipython`` and ``pylab`` installed. +.. #. getting started with ``ipython``. +.. #. loading data from files +.. #. plotting the data + + +.. Author : Anoop Jacob Thomas + Internal Reviewer : Puneeth + External Reviewer : + Language Reviewer : Bhanukiran + Checklist OK? : <10-11-2010, Anand, OK> [2010-10-05] + +.. #[Puneeth: Quickref missing] + +=================== +Other type of plots +=================== + +{{{ show the first slide }}} + +Hello and welcome to the tutorial ``The other kinds of plots``. + +.. #[Puneeth: this sentence doesn't read well] + +{{{ show the outline slide }}} + +.. #[Puneeth: motivate looking at other plots. Why are we looking at +.. them? Tell that we have only looked at one type of plot all the +.. while, etc.] + +Till now we have seen only one kind of plotting, and in this tutorial we +are going to see more kinds of plots such as the scatter plot, the pie chart, the bar chart and +the log-log plot. This tutorial covers the making of other kinds of +plots and also gives an introduction to matplotlib help. + +.. #[Puneeth: cover, see and introduce you. be consistent. does, the +.. "We" include the viewer or not?] + +Let us start with scatter plot. + +{{{ 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 +horizontal axis and the value of the other variable determining the +position on the vertical axis. This kind of plot is also called a +scatter chart, a scatter diagram or a scatter graph. + +Before we proceed further, start your IPython interpreter +:: + + ipython -pylab + +{{{ open the ipython interpreter in the terminal using the command +ipython -pylab }}} + +{{{ switch to the next slide having the problem statement of first +exercise }}} + +Now, let us plot a scatter plot showing the percentage profit of +a company A from the year 2000-2010. The data for the same is available +in the file ``company-a-data.txt``. + +{{{ open the file company-a-data.txt and show the content }}} + +The data file has two lines with a set of values in each line, the +first line representing years and the second line representing the +profit percentages. + +{{{ close the file and switch to the terminal }}} + +To produce the scatter plot, we first need to load the data from the +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())) + +By default loadtxt converts the value to float. The +``dtype=type(int())`` argument in loadtxt converts the value to +integer as we require the data as integer further in the tutorial. + +.. #[Puneeth: make a remark about dtype, that has not been covered in +.. the loadtxt tutorial.] + +{{{ switch to next slide, ``scatter`` function }}} + +Now in-order to generate the scatter graph we will use the function +``scatter()`` +:: + + scatter(year,profit) + +Notice that we passed two arguments to ``scatter()`` function, first +one the values in x-coordinate, year, and the other the values in +y-coordinate, the profit percentage. + +{{{ switch to the next slide which has the problem statement of +problem to be tried out }}} + +Now here is a question for you to try out, plot the same data with red +diamonds markers. + +.. **Clue** - *try scatter? in your ipython interpreter* + +Pause here and solve the question before moving on. + +.. scatter(year,profit,color='r',marker='d') + +Now let us see another kind of plot, the pie chart, for the same data. + +.. #[Puneeth: instead of just saying that, say that let's plot a pie +.. chart for the same data. continuity, will be good.] + +{{{ switch to the slide which says about pie chart }}} + +A pie chart or a circle graph is a circular chart divided into +sectors, illustrating proportion. + +{{{ switch to the slide showing the problem statement of second +exercise question }}} + +Plot a pie chart representing the profit percentage of company A, with +the same data from file ``company-a-data.txt``. So let us reuse the +data we have loaded from the file previously. + +.. #[Puneeth, this part can be move above.] + +{{{ switch to next slide, ``pie()`` function }}} + +We can plot the pie chart using the function ``pie()``. +:: + + pie(profit,labels=year) + +Notice that we passed two arguments to the function ``pie()``. First +one the values and the next one the set of labels to be used in the +pie chart. + +{{{ switch to the next slide which has the problem statement of +problem to be tried out }}} + +Now here is a question for you to try out, plot a pie chart with the +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* + +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')) + +{{{ switch to the slide which says about bar chart }}} + +Now let us move on to the bar charts. A bar chart or bar graph is a chart +with rectangular bars with lengths proportional to the values that +they represent. + +{{{ switch to the slide showing the problem statement of fifth +exercise question }}} + +Plot a bar chart representing the profit percentage of company A, with +the same data from file ``company-a-data.txt``. + +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()``. +:: + + bar(year,profit) + +Note that the function ``bar()`` needs at least two arguments one the +values in x-coordinate and the other values in y-coordinate which is +used to determine the height of the bars. + +{{{ switch to the next slide which has the problem statement of +problem to be tried out }}} + +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. The data for the chart may be obtained from +the file ``company-a-data.txt``. + +.. **Clue** - *try bar? in your ipython interpreter* + +.. bar(year,profit,fill=False,hatch='/') + +{{{ switch to the slide which says about log-log graph }}} + +Now let us move on to the log-log plot. A log-log graph or a log-log plot is +a two-dimensional graph of numerical data that uses logarithmic scales +on both the horizontal and vertical axes. Because of the nonlinear +scaling of the axes, a function of the form y = ax\ :sup:`b` will +appear as a straight line on a log-log graph + +{{{ switch to the slide showing the problem statement of fourth +exercise question }}} + + +Plot a `log-log` chart of y=5*x\ :sup:`3` for x from 1-20. + +Before we actually plot let us calculate the points needed for +that. +:: + + 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, +:: + + loglog(x,y) + +To understand the difference between a normal ``plot`` and a ``log-log +plot`` let us create another plot using the function ``plot``. +:: + + figure(2) + plot(x,y) + +{{{ show both the plots side by side }}} + +So that was ``log-log() plot``. + +{{{ switch to the next slide which says: "How to get help on +matplotlib online"}}} + +Now we will see few more plots and also see how to access help of +matplotlib over the internet. + +Help about matplotlib can be obtained from +matplotlib.sourceforge.net/contents.html + + +More plots can be seen at +matplotlib.sourceforge.net/users/screenshots.html and also at +matplotlib.sourceforge.net/gallery.html + +{{{ 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 +and covered how to access the matplotlib online help. + +{{{ switch to the thank you slide }}} + +Thank you! diff -r d33698326409 -r 54bdda4aefa5 other_types_of_plots/slides.org --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/other_types_of_plots/slides.org Thu Dec 02 14:43:42 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 + + diff -r d33698326409 -r 54bdda4aefa5 other_types_of_plots/slides.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/other_types_of_plots/slides.tex Thu Dec 02 14:43:42 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} diff -r d33698326409 -r 54bdda4aefa5 progress.org --- a/progress.org Wed Dec 01 16:51:35 2010 +0530 +++ b/progress.org Thu Dec 02 14:43:42 2010 +0530 @@ -1,56 +1,56 @@ -| S.No | Name | Units | Author | Review | Checklist | -|---------+----------------------------------------+-------+----------+-----------------+-----------| -| 1.2 LO: | getting started with =ipython= | 2 | Punch | Anoop(Done) | | -| 1.3 LO: | using the =plot= command interactively | 2 | Amit | Pending | | -| 1.4 LO: | embellishing a plot | 2 | Nishanth | Anoop (Done) | | -| 1.5 LO: | saving plots | 2 | Anoop | Punch (Done) | | -| 1.6 LO: | multiple plots | 3 | Madhu | Nishanth (Done) | | -| 1.7 LO: | additional features of IPython | 2 | Nishanth | Amit (Done) | | -| 1.8 LO: | module level assessment | 3 | Madhu | | | -|---------+----------------------------------------+-------+----------+-----------------+-----------| -| 2.2 LO: | loading data from files | 3 | Punch | Nishanth (Done) | | -| 2.3 LO: | plotting the data | 3 | Amit | Anoop (Done) | | -| 2.4 LO: | other types of plots | 3 | Anoop | Punch (Done) | | -| 2.5 LO: | module level assessment | 3 | Nishanth | | | -|---------+----------------------------------------+-------+----------+-----------------+-----------| -| 3.1 LO: | getting started with lists | 2 | Amit | Anoop(Done) | | -| 3.2 LO: | getting started with =for= | 2 | Anoop | Nishanth (Done) | | -| 3.3 LO: | getting started with strings | 2 | Madhu | Punch (Done) | | -| 3.4 LO: | getting started with files | 3 | Punch | Anoop(Done) | | -| 3.5 LO: | parsing data | 3 | Nishanth | Amit (Done) | | -| 3.6 LO: | statistics | 2 | Amit | Punch (Done) | | -| 3.7 LO: | module level assessment | 3 | Madhu | | | -|---------+----------------------------------------+-------+----------+-----------------+-----------| -| 4.1 LO: | getting started with arrays | 2 | Anoop | Punch (Done) | | -| 4.2 LO: | accessing parts of arrays | 4 | Punch | Anoop (Done) | | -| 4.3 LO: | Matrices | 3 | Anoop | Punch (Done) | | -| 4.4 LO: | Least square fit | 2 | Nishanth | Punch (Done) | | -| 4.5 LO: | Assessment | 3 | Punch | | | -|---------+----------------------------------------+-------+----------+-----------------+-----------| -| 5.1 LO: | getting started with sage notebook | 3 | Madhu | Punch (Done) | | -| 5.2 LO: | getting started with symbolics | 3 | Amit | Punch (Done) | | -| 5.3 LO: | using Sage | 4 | Punch | Anoop (Done) | | -| 5.4 LO: | using sage to teach | 3 | Nishanth | Punch (Done) | | -| 5.5 LO: | Assessment | 3 | Anoop | | | -|---------+----------------------------------------+-------+----------+-----------------+-----------| -| 6.1 LO: | basic datatypes & operators | 4 | Amit | Punch (Done) | | -| 6.2 LO: | I/O | 1 | Nishanth | Amit (Done) | | -| 6.3 LO: | conditionals | 2 | Madhu | Punch (Pending) | | -| 6.4 LO: | loops | 2 | Punch | Anoop (Done) | | -| 6.5 LO: | Assessment | 3 | Anoop | | | -|---------+----------------------------------------+-------+----------+-----------------+-----------| -| 7.1 LO: | manipulating lists | 3 | Madhu | Punch (Done) | | -| 7.2 LO: | manipulating strings | 2 | Punch | Amit (Done) | | -| 7.3 LO: | getting started with tuples | 2 | Nishanth | Punch (Done) | | -| 7.4 LO: | dictionaries | 2 | Anoop | Punch (Done) | | -| 7.5 LO: | sets | 2 | Nishanth | Punch (Done) | | -| 7.6 LO: | Assessment | 3 | Amit | | | -|---------+----------------------------------------+-------+----------+-----------------+-----------| -| 8.1 LO: | getting started with functions | 3 | Anoop | Punch (Done) | | -| 8.2 LO: | advanced features of functions | 3 | Punch | Anoop (Done) | | -| 8.3 LO: | using python modules | 3 | Anoop | Punch (Done) | | -| 8.4 LO: | writing python scripts | 2 | Nishanth | Punch (Done) | | -| 8.5 LO: | testing and debugging | 2 | Amit | | | -| 8.6 LO: | Assessment | 3 | Madhu | | | -|---------+----------------------------------------+-------+----------+-----------------+-----------| +| S.No | Name | Units | Author | Review | Checklist | +|---------+------------------------------------+-------+----------+-----------------+-----------| +| 1.2 LO: | getting started with =ipython= | 2 | Punch | Anoop(Done) | | +| 1.3 LO: | using =plot= interactively | 2 | Amit | Pending | | +| 1.4 LO: | embellishing a plot | 2 | Nishanth | Anoop (Done) | | +| 1.5 LO: | saving plots | 2 | Anoop | Punch (Done) | | +| 1.6 LO: | multiple plots | 3 | Madhu | Nishanth (Done) | | +| 1.7 LO: | additional features of IPython | 2 | Nishanth | Amit (Done) | | +| 1.8 LO: | module level assessment | 3 | Madhu | | | +|---------+------------------------------------+-------+----------+-----------------+-----------| +| 2.2 LO: | loading data from files | 3 | Punch | Nishanth (Done) | | +| 2.3 LO: | plotting data | 3 | Amit | Anoop (Done) | | +| 2.4 LO: | other types of plots | 3 | Anoop | Punch (Done) | | +| 2.5 LO: | module level assessment | 3 | Nishanth | | | +|---------+------------------------------------+-------+----------+-----------------+-----------| +| 3.1 LO: | getting started with lists | 2 | Amit | Anoop(Done) | | +| 3.2 LO: | getting started with =for= | 2 | Anoop | Nishanth (Done) | | +| 3.3 LO: | getting started with strings | 2 | Madhu | Punch (Done) | | +| 3.4 LO: | getting started with files | 3 | Punch | Anoop(Done) | | +| 3.5 LO: | parsing data | 3 | Nishanth | Amit (Done) | | +| 3.6 LO: | statistics | 2 | Amit | Punch (Done) | | +| 3.7 LO: | module level assessment | 3 | Madhu | | | +|---------+------------------------------------+-------+----------+-----------------+-----------| +| 4.1 LO: | getting started with arrays | 2 | Anoop | Punch (Done) | | +| 4.2 LO: | accessing parts of arrays | 4 | Punch | Anoop (Done) | | +| 4.3 LO: | Matrices | 3 | Anoop | Punch (Done) | | +| 4.4 LO: | Least square fit | 2 | Nishanth | Punch (Done) | | +| 4.5 LO: | Assessment | 3 | Punch | | | +|---------+------------------------------------+-------+----------+-----------------+-----------| +| 5.1 LO: | getting started with sage notebook | 3 | Madhu | Punch (Done) | | +| 5.2 LO: | getting started with symbolics | 3 | Amit | Punch (Done) | | +| 5.3 LO: | using Sage | 4 | Punch | Anoop (Done) | | +| 5.4 LO: | using sage to teach | 3 | Nishanth | Punch (Done) | | +| 5.5 LO: | Assessment | 3 | Anoop | | | +|---------+------------------------------------+-------+----------+-----------------+-----------| +| 6.1 LO: | basic datatypes and operators | 4 | Amit | Punch (Done) | | +| 6.2 LO: | input output | 1 | Nishanth | Amit (Done) | | +| 6.3 LO: | conditionals | 2 | Madhu | Punch (Pending) | | +| 6.4 LO: | loops | 2 | Punch | Anoop (Done) | | +| 6.5 LO: | Assessment | 3 | Anoop | | | +|---------+------------------------------------+-------+----------+-----------------+-----------| +| 7.1 LO: | manipulating lists | 3 | Madhu | Punch (Done) | | +| 7.2 LO: | manipulating strings | 2 | Punch | Amit (Done) | | +| 7.3 LO: | tuples | 2 | Nishanth | Punch (Done) | | +| 7.4 LO: | dictionaries | 2 | Anoop | Punch (Done) | | +| 7.5 LO: | sets | 2 | Nishanth | Punch (Done) | | +| 7.6 LO: | Assessment | 3 | Amit | | | +|---------+------------------------------------+-------+----------+-----------------+-----------| +| 8.1 LO: | getting started with functions | 3 | Anoop | Punch (Done) | | +| 8.2 LO: | advanced features of functions | 3 | Punch | Anoop (Done) | | +| 8.3 LO: | using python modules | 3 | Anoop | Punch (Done) | | +| 8.4 LO: | writing python scripts | 2 | Nishanth | Punch (Done) | | +| 8.5 LO: | testing and debugging | 2 | Amit | | | +| 8.6 LO: | Assessment | 3 | Madhu | | | +|---------+------------------------------------+-------+----------+-----------------+-----------| diff -r d33698326409 -r 54bdda4aefa5 sets/quickref.tex --- a/sets/quickref.tex Wed Dec 01 16:51:35 2010 +0530 +++ b/sets/quickref.tex Thu Dec 02 14:43:42 2010 +0530 @@ -9,7 +9,7 @@ Other operations available:\\ -\begin{lstlising} +\begin{lstlisting} \item "\&" -- Intersection \item "-" -- Difference \item "\^" -- Symmetric Difference