Re: Overlaying List...Plots with other Plots?
- To: mathgroup at smc.vnet.net
- Subject: [mg103421] Re: Overlaying List...Plots with other Plots?
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Mon, 21 Sep 2009 05:50:43 -0400 (EDT)
On 9/20/09 at 6:23 AM, max at alcyone.com (Erik Max Francis) wrote: >What's the smoothest way to draw a ListPlot (or its friends, >ListLogPlot, ListLogLogPlot, etc.) with another plot of just a >normal function (which is actually a curve fit to the data) on top >of the ListPlot? >I know that I can just do two plots (which are just Graphics objects >anyway) and then show them simultaneously with show, but since it's >a ListPlot, but since I'm dealing with an arbitrary set of data I >don't know what the bounds of the plot will be, so I don't see how >to easily choose the proper limits for the second Plot to Show >together. >I presume there must be a standard way of doing this since it's a >pretty common operation; what's the "proper" way to do it? I don't know that there is a standard way. And as for proper way, I would say anything that yields the desired result can be considered proper. In any case, here is one way data = RandomReal[1, {10, 2}]; f = FindFit[data, m x + b , {m, b}, x]; Plot[m x + b /. f, {x, 0, 1}, Frame -> True, Axes -> None, Epilog -> {Point[data]}, PlotRange -> {.95 Min@data[[All, 2]], 1.05 Max@data[[All, 2]]}]