MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: question about plotting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119135] Re: question about plotting
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Sun, 22 May 2011 06:58:36 -0400 (EDT)

If you have David Park's Presentations application
(http://home.comcast.net/~djmpark/DrawGraphicsPage.html),
then another way to do this sort of thing -- which I find a more natural 
way than using Show or, especially, an Epilog -- is to just plunk down 
one graphics command after another inside a Draw2D:

   data = Table[{x, 3 x^2 - 5 x + 7 + 10*RandomReal[]}, {x, 0, 5, .1}];
   f[x_] = Fit[data, {1, x, x^2}, x];

   Draw2D[
     {
      Blue, Draw[f[x], {x, 0, 5}],
      Red, ListDraw[data]
     },
     Axes -> True, AspectRatio -> 0.75]

(I deliberately used "pretty printing" to emphasize the syntactical 
structure.)

On 5/21/2011 6:51 AM, Bob Hanlon wrote:
> Clear[a, b, c, x]
>
> data = Table[{x, 3 x^2 - 5 x + 7 + 10*RandomReal[]}, {x, 0, 5, .1}];
>
> f[x_] = Fit[data, {1, x, x^2}, x];
>
> Plot[f[x], {x, 0, 5}, Epilog ->  {Red, Point[data]}]
>
> Show[ListPlot[data, PlotStyle ->  Red], Plot[f[x], {x, 0, 5}]]
>
>
> Bob Hanlon
>
> ---- Krzysztof Kutak<krzysztof.kutak at googlemail.com>  wrote:
>
> =============
> Hello,
> I would like to combine plot od datapoints in one dimension(for this I
> use ListPlot[data]) with fitted function ( f[r] ). Do you know how to
> do this?
>
> Best wishes
> Krzysztof
>
>

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: unable to import csv-Data
  • Next by Date: Re: MLGetReal(Double) Problem in MathLink
  • Previous by thread: Re: question about plotting
  • Next by thread: Convert Matrix to Sparse Matrix