# HG changeset patch # User Nishanth # Date 1285172348 -19800 # Node ID a005328abdf02851d28a44490fd64dd1c8394491 # Parent c66ee1743d2592e2ebf6fbb3297b581d9a8e2531 Reviewed multiple_plots diff -r c66ee1743d25 -r a005328abdf0 multiple-plots.rst --- a/multiple-plots.rst Wed Sep 22 20:01:59 2010 +0530 +++ b/multiple-plots.rst Wed Sep 22 21:49:08 2010 +0530 @@ -6,9 +6,11 @@ In this tutorial, we will learn how to draw more than one plot, how to add legends to each plot to indicate what each plot represents. We -will also learn how to switch between the plots and creating multiple +will also learn how to switch between the plots and create multiple plots with different regular axes which are also called as subplots. +.. #[Nishanth]: See diff - edited a grammatical mistake + {{{ Shift to terminal and start ipython -pylab }}} To begin with let us start ipython with pylab, by typing:: @@ -25,6 +27,11 @@ linspace command creates 10 points in the interval between 0 and 50 both inclusive. We assign these values to a variable called x. +.. #[Nishanth]: pre requisite for this LO is basic plotting which + covers linspace and plot. So you may not need to + specify all that again. But not a problem if it is + there also. + Now let us draw a plot simple sine plot using these points:: plot(x, sin(x)) @@ -34,9 +41,11 @@ {{{ Switch to the plot window }}} Oh! wait! Is that a nice sine plot? Does a sine plot actually look -like that? We know that a sine plot is a smooth curve is it not? What +like that? We know that a sine plot is a smooth curve. Is it not? What really caused this? +.. #[Nishanth]: See diff + {{{ pause for a while }}} A small investigation on linspace tells us that we chose too few @@ -44,6 +53,11 @@ smooth. So now let us use linspace again to get 500 points between 0 and 100 and draw the sine plot +.. #[Nishanth]: Here specify that when we do plot(x, sin(x) + it is actually plotting two sets of points + and not analytical functions. Hence the sharp + curve. + {{{ Switch to ipython andtype }}} :: y = linspace(0, 50, 500) @@ -78,6 +92,14 @@ Now we have two plots, a sine plot and a cosine plot one overlaid upon the other. +.. #[Nishanth]: figure(1) and figure(2) give two different plots. + The remaining script moves on the fact that they + give overlaid plots which is not the case. + So clear the figure and plot cos and sin without + introducing figure command. Then introduce legend + and finish off the everything on legend. + Then introduce figure command. + {{{ Have both plot window and ipython side by side }}} The figure command takes an integer as an argument which is the serial @@ -107,6 +129,9 @@ legend(['sin(x)', 'cos(x)']) +.. #[Nishanth]: This legend may go up in the script. May be before + introducing the figure command itself. + The legend command takes a single list of parameters where each parameter is the text indicating the plots in the order of their serial number. @@ -172,8 +197,15 @@ 100 and y-axis varies from 0 to 1 where as for the parabolic plot the x-axis varies from 0 to 10 and y-axis varies from 0 to 100 +.. #[Nishanth]: stress on the similarity between subplot and figure commands + {{{ Show summary slide }}} +.. #[Nishanth]: Exercises are missing in the script + one exercise for overlaid plot and legend + one for figure command + one for subplot must do + This brings us to the end of another session. In this tutorial session we learnt @@ -184,6 +216,8 @@ * the legend command and * creating and switching between subplots +.. #[Nishanth]: legend command can be told right after overlaid plots + {{{ Show the "sponsored by FOSSEE" slide }}} This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India @@ -193,6 +227,6 @@ .. Author : Madhu Internal Reviewer 1 : [potential reviewer: Puneeth] - Internal Reviewer 2 : [potential reviewer: Nishanth] + Internal Reviewer 2 : Nishanth External Reviewer : diff -r c66ee1743d25 -r a005328abdf0 progress.org --- a/progress.org Wed Sep 22 20:01:59 2010 +0530 +++ b/progress.org Wed Sep 22 21:49:08 2010 +0530 @@ -4,7 +4,7 @@ | 1.3 LO: | using the =plot= command interactively | 2 | Amit | Anoop (Pending) | Puneeth (Pending) | | 1.4 LO: | embellishing a plot | 2 | Nishanth | Anoop (Done) | Madhu (Done) | | 1.5 LO: | saving plots | 2 | Anoop | | | -| 1.6 LO: | multiple plots | 3 | Madhu | Nishanth (Pending) | Punch (Pending) | +| 1.6 LO: | multiple plots | 3 | Madhu | Nishanth (Done) | Punch (Pending) | | 1.7 LO: | additional features of IPython | 2 | Nishanth | Amit (Pending) | Madhu (Pending) | | 1.8 LO: | module level assessment | 3 | Madhu | | | |---------+----------------------------------------+-------+----------+---------------------+---------------------|