equal
deleted
inserted
replaced
14 .. ------------- |
14 .. ------------- |
15 |
15 |
16 .. 1. Using the ``plot`` command interactively |
16 .. 1. Using the ``plot`` command interactively |
17 |
17 |
18 .. Author : Nishanth Amuluru |
18 .. Author : Nishanth Amuluru |
19 Internal Reviewer : |
19 Internal Reviewer : Anoop |
20 External Reviewer : |
20 External Reviewer : |
|
21 Language Reviewe : Bhanukiran |
21 Checklist OK? : <put date stamp here, if OK> [2010-10-05] |
22 Checklist OK? : <put date stamp here, if OK> [2010-10-05] |
22 |
23 |
23 Script |
24 Script |
24 ------ |
25 ------ |
25 |
26 |
28 {{{ Show the slide containing title }}} |
29 {{{ Show the slide containing title }}} |
29 |
30 |
30 {{{ Show the slide containing the outline }}} |
31 {{{ Show the slide containing the outline }}} |
31 |
32 |
32 In this tutorial, we shall look at how to modify the colour, thickness and |
33 In this tutorial, we shall look at how to modify the colour, thickness and |
33 linestyle of the plot. We shall then learn how to add title to the plot and |
34 linestyle of a plot. We shall then learn how to add title to a plot and |
34 then look at adding labels to x and y axes. we shall also look at adding |
35 then look at adding labels to x and y axes. we shall also look at adding |
35 annotations to the plot and setting the limits of axes. |
36 annotations to the plot and setting the limits on the axes. |
36 |
37 |
37 Let us start ipython with pylab loaded, by typing on the terminal |
38 Let us start ipython with pylab loaded, by typing on the terminal |
38 |
39 |
39 {{{ shift to terminal and type ipython -pylab }}} |
40 {{{ shift to terminal and type ipython -pylab }}} |
40 |
41 |
57 |
58 |
58 .. #[madhu: Standard is to choose between -50 to 50 or 0 to 50 with 100 |
59 .. #[madhu: Standard is to choose between -50 to 50 or 0 to 50 with 100 |
59 points right?] |
60 points right?] |
60 |
61 |
61 As we can see, the default colour and the default thickness of the |
62 As we can see, the default colour and the default thickness of the |
62 line is as decided by pylab. Wouldn't be nice if we could control |
63 line is as decided by pylab. Wouldn't it be nice if we could control |
63 these parameters in the plot? This is possible by passing additional |
64 these parameters in the plot? This is possible by passing additional |
64 arguments to the plot command. |
65 arguments to the plot command. |
65 |
66 |
66 .. #[[Anoop: I think it will be good to rephrase the sentence]] |
67 .. #[[Anoop: I think it will be good to rephrase the sentence]] |
67 .. #[madhu: Why "you" here? Shouldn't this be "we" as decided? Also I |
68 .. #[madhu: Why "you" here? Shouldn't this be "we" as decided? Also I |
68 added "the default" check the diff] |
69 added "the default" check the diff] |
69 |
|
70 The additional argument that we shall be passing in here now is the |
70 The additional argument that we shall be passing in here now is the |
71 colour argument. We shall first clear the figure and plot the same in |
71 colour argument. We shall first clear the figure and plot the same in |
72 red colour. Hence |
72 red colour. Hence |
73 |
73 |
74 .. #[Madhu: Note the diff for changes] |
74 .. #[Madhu: Note the diff for changes] |
241 {{{ continue from the paused state }}} |
241 {{{ continue from the paused state }}} |
242 |
242 |
243 The solution is to enclose the whole string in between $. Hence, |
243 The solution is to enclose the whole string in between $. Hence, |
244 :: |
244 :: |
245 |
245 |
246 title("$Parabolic function -x^2+4x-5$") |
246 title("Parabolic function $-x^2+4x-5$") |
|
247 #[[Bhanu: Dollar sign should enclose only the math-expression. change |
|
248 made.]] |
247 |
249 |
248 gives a title that looks neatly formatted. |
250 gives a title that looks neatly formatted. |
249 |
251 |
250 Although we have title, the plot is not complete without labelling x |
252 Although we have title, the plot is not complete without labelling x |
251 and y axes. Hence we shall label x-axis to "x" and y-axis to "f(x)" :: |
253 and y axes. Hence we shall label x-axis to "x" and y-axis to "f(x)" :: |