diff -r 1a73dddb1d05 -r 0a0a91fb3a0d other-type-of-plots/script.rst --- 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