embellishing_a_plot/script.rst
changeset 524 b602b4dcc87d
parent 495 139bf21a9473
equal deleted inserted replaced
523:54bdda4aefa5 524:b602b4dcc87d
    65 arguments to the plot command.
    65 arguments to the plot command.
    66 
    66 
    67 .. #[[Anoop: I think it will be good to rephrase the sentence]]
    67 .. #[[Anoop: I think it will be good to rephrase the sentence]]
    68 .. #[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
    69      added "the default" check the diff]
    69      added "the default" check the diff]
       
    70 
    70 The additional argument that we shall be passing in here now is the
    71 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
    72 colour argument. We shall first clear the figure and plot the same in
    72 red colour. Hence
    73 red colour. Hence
    73 
    74 
    74 .. #[Madhu: Note the diff for changes]
    75 .. #[Madhu: Note the diff for changes]
    75  ::
    76 
       
    77 ::
    76 
    78 
    77     clf()
    79     clf()
    78     plot(x, sin(x), 'r')
    80     plot(x, sin(x), 'r')
    79 
    81 
    80 As we can see we have the same plot but now in red colour.
    82 As we can see we have the same plot but now in red colour.
    81 
    83 
    82 .. #[Madhu: diff again]
    84 .. #[Madhu: diff again]
    83 
    85 
    84 To alter the thickness of the line, we use the ``linewidth`` argument in the plot
    86 To alter the thickness of the line, we use the ``linewidth`` argument
    85 command. Hence
    87 in the plot command. Hence ::
    86 ::
       
    87 
    88 
    88     plot(x, cos(x), linewidth=2)
    89     plot(x, cos(x), linewidth=2)
    89 
    90 
    90 produces a plot with a thicker line, to be more precise plot with line
    91 produces a plot with a thicker line, to be more precise plot with line
    91 thickness 2.
    92 thickness 2.
    94    same plot, as you have not cleared the figure]]
    95    same plot, as you have not cleared the figure]]
    95 .. #[Madhu: To Anoop, not necessary I feel since they can see it?]
    96 .. #[Madhu: To Anoop, not necessary I feel since they can see it?]
    96 
    97 
    97 {{{ Show the plot and compare the sine and cos plots }}}
    98 {{{ Show the plot and compare the sine and cos plots }}}
    98 
    99 
    99 {{{ Pause here and try out the following exercises }}}
   100 Pause here and try out the following exercises,
   100 
   101 
   101 .. #[[Anoop: is the above a context switch for the person who does the
   102 .. #[[Anoop: is the above a context switch for the person who does the
   102    recording, other wise if it an instruction to the person viewing
   103    recording, other wise if it an instruction to the person viewing
   103    the video, then I guess the three braces can be removed.]]
   104    the video, then I guess the three braces can be removed.]]
   104 
   105 
   151 {{{ Show the options available for line style and colors }}}
   152 {{{ Show the options available for line style and colors }}}
   152 
   153 
   153 .. #[Madhu: The script needs to tell what needs to be shown or
   154 .. #[Madhu: The script needs to tell what needs to be shown or
   154      explained.]
   155      explained.]
   155 
   156 
   156 {{{ Pause here and try out the following exercises }}}
   157 Pause here and try out the following exercises
   157 
   158 
   158 .. #[[Anoop: same question as above, should it be read out?]]
   159 .. #[[Anoop: same question as above, should it be read out?]]
   159 
   160 
   160 %% 2 %% Plot the sine curve with green filled circles.
   161 %% 2 %% Plot the sine curve with green filled circles.
   161 
   162 
   242 
   243 
   243 The solution is to enclose the whole string in between $. Hence,
   244 The solution is to enclose the whole string in between $. Hence,
   244 ::
   245 ::
   245 
   246 
   246     title("Parabolic function $-x^2+4x-5$")
   247     title("Parabolic function $-x^2+4x-5$")
   247 #[[Bhanu: Dollar sign should enclose only the math-expression. change
   248 
   248 made.]]
   249 .. #[[Bhanu: Dollar sign should enclose only the math-expression. change
       
   250    made.]]
   249 
   251 
   250 gives a title that looks neatly formatted.
   252 gives a title that looks neatly formatted.
   251 
   253 
   252 Although we have title, the plot is not complete without labelling x
   254 Although we have title, the plot is not complete without labelling x
   253 and y axes. Hence we shall label x-axis to "x" and y-axis to "f(x)" ::
   255 and y axes. Hence we shall label x-axis to "x" and y-axis to "f(x)" ::