equal
deleted
inserted
replaced
15 |
15 |
16 :: |
16 :: |
17 |
17 |
18 ipython -pylab |
18 ipython -pylab |
19 |
19 |
20 #[madhu: I feel the instructions should precede the actual action, |
20 .. #[madhu: I feel the instructions should precede the actual action, |
|
21 |
21 since while recording we need to know before hand what we need to do] |
22 since while recording we need to know before hand what we need to do] |
22 |
23 |
23 We shall first make a simple plot and start decorating it. |
24 We shall first make a simple plot and start decorating it. |
24 |
25 |
25 .. #[madhu: start decorating it should be fine, with is not necessary] |
26 .. #[madhu: start decorating it should be fine, with is not necessary] |
53 |
54 |
54 As we can see we have the same plot but now in red colour. |
55 As we can see we have the same plot but now in red colour. |
55 |
56 |
56 .. #[Madhu: diff again] |
57 .. #[Madhu: diff again] |
57 |
58 |
58 To alter the thickness of the line, we use the =linewidth= argument in the plot |
59 To alter the thickness of the line, we use the ``linewidth`` argument in the plot |
59 command. Hence |
60 command. Hence |
60 :: |
61 :: |
61 |
62 |
62 plot(x, cos(x), linewidth=2) |
63 plot(x, cos(x), linewidth=2) |
63 |
64 |
88 |
89 |
89 .. #[[Anoop: add clf()]] |
90 .. #[[Anoop: add clf()]] |
90 |
91 |
91 produces the required plot |
92 produces the required plot |
92 |
93 |
93 #[Nishanth]: I could not think of a SIMPLE recipe approach for |
94 .. #[Nishanth]: I could not think of a SIMPLE recipe approach for |
94 introducing linestyle. Hence the naive approach. |
95 introducing linestyle. Hence the naive approach. |
95 |
96 |
96 .. #[[Anoop: I guess the recipe is fine, but would be better if you |
97 .. #[[Anoop: I guess the recipe is fine, but would be better if you |
97 add the problem statement rather than just saying "let's do a simple |
98 add the problem statement rather than just saying "let's do a simple |
98 plot"]] |
99 plot"]] |
165 We now have the plot in a colour and linewidth of our interest. As you can see, |
166 We now have the plot in a colour and linewidth of our interest. As you can see, |
166 the figure does not have any description describing the plot. |
167 the figure does not have any description describing the plot. |
167 |
168 |
168 .. #[Madhu: Added "not". See the diff] |
169 .. #[Madhu: Added "not". See the diff] |
169 |
170 |
170 We will now add a title to the plot by using the =title= command. |
171 We will now add a title to the plot by using the ``title`` command. |
171 :: |
172 :: |
172 |
173 |
173 title("Parabolic function -x^2+4x-5") |
174 title("Parabolic function -x^2+4x-5") |
174 |
175 |
175 {{{ Show the plot window and point to the title }}} |
176 {{{ Show the plot window and point to the title }}} |
176 |
177 |
177 The figure now has a title which describes what the plot is. The |
178 The figure now has a title which describes what the plot is. The |
178 =title= command as you can see, takes a string as an argument and sets |
179 ``title`` command as you can see, takes a string as an argument and sets |
179 the title accordingly. |
180 the title accordingly. |
180 |
181 |
181 .. #[Madhu: See the diff] |
182 .. #[Madhu: See the diff] |
182 |
183 |
183 The formatting in title is messed and it does not look clean. You can imagine |
184 The formatting in title is messed and it does not look clean. You can imagine |
192 |
193 |
193 title("Parabolic function $-x^2+4x-5$") |
194 title("Parabolic function $-x^2+4x-5$") |
194 |
195 |
195 and we get the polynomial formatted properly. |
196 and we get the polynomial formatted properly. |
196 |
197 |
197 #[Nishanth]: Unsure if I have to give this exercise since enclosing the whole |
198 .. #[Nishanth]: Unsure if I have to give this exercise since enclosing the whole |
198 string in LaTex style is not good |
199 string in LaTex style is not good |
199 |
200 |
200 .. #[[Anoop: I guess you can go ahead with the LaTex thing, it's |
201 .. #[[Anoop: I guess you can go ahead with the LaTex thing, it's |
201 cool!]] |
202 cool!]] |
202 .. #[Madhu: Instead of saying LaTeX style you can say Typeset math |
203 .. #[Madhu: Instead of saying LaTeX style you can say Typeset math |
222 |
223 |
223 xlabel("x") |
224 xlabel("x") |
224 |
225 |
225 {{{ Switch to plot window and show the xlabel }}} |
226 {{{ Switch to plot window and show the xlabel }}} |
226 |
227 |
227 As you can see, =xlabel= command takes a string as an argument, |
228 As you can see, ``xlabel`` command takes a string as an argument, |
228 similar to the =title= command and sets it as the label to x-axis. |
229 similar to the ``title`` command and sets it as the label to x-axis. |
229 |
230 |
230 .. #[See the diff] |
231 .. #[See the diff] |
231 |
232 |
232 Similarly, |
233 Similarly, |
233 :: |
234 :: |
262 |
263 |
263 annotate("local maxima", xy=(2, -1)) |
264 annotate("local maxima", xy=(2, -1)) |
264 |
265 |
265 {{{ Show the annotation that has appeared on the plot }}} |
266 {{{ Show the annotation that has appeared on the plot }}} |
266 |
267 |
267 As you can see, the first argument to =annotate= command is the name we would |
268 As you can see, the first argument to ``annotate`` command is the name we would |
268 like to mark the point as and the second argument is the co-ordinates of the |
269 like to mark the point as and the second argument is the co-ordinates of the |
269 point at which the name should appear. It is a sequence containing two numbers. |
270 point at which the name should appear. It is a sequence containing two numbers. |
270 The first is x co-ordinate and second is y co-ordinate. |
271 The first is x co-ordinate and second is y co-ordinate. |
271 |
272 |
272 .. #[[Anoop: I think we should tell explicitely that xy takes a |
273 .. #[[Anoop: I think we should tell explicitely that xy takes a |
293 * How to label x and y axes |
294 * How to label x and y axes |
294 * How to add annotations |
295 * How to add annotations |
295 |
296 |
296 {{{ Show the "sponsored by FOSSEE" slide }}} |
297 {{{ Show the "sponsored by FOSSEE" slide }}} |
297 |
298 |
298 #[Nishanth]: Will add this line after all of us fix on one. |
299 .. #[Nishanth]: Will add this line after all of us fix on one. |
|
300 |
299 This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India |
301 This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India |
300 |
302 |
301 Hope you have enjoyed and found it useful. |
303 Hope you have enjoyed and found it useful. |
302 Thankyou |
304 Thankyou |
303 |
305 |