Re: Overlaying List...Plots with other Plots?
- To: mathgroup at smc.vnet.net
- Subject: [mg103432] Re: [mg103406] Overlaying List...Plots with other Plots?
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Mon, 21 Sep 2009 05:52:46 -0400 (EDT)
- Reply-to: hanlonr at cox.net
data = {{0, 1}, {1, 0}, {3, 2},
{5, 4}, {6, 4}, {7, 5}};
nlm = NonlinearModelFit[data,
Log[a + b x^2], {a, b}, x];
Module[{xi = data[[All, 1]]},
Show[
ListPlot[Tooltip[data],
PlotStyle ->
{Red, PointSize[Medium]}],
Plot[Tooltip[nlm[x]],
{x, Min[xi], Max[xi]}],
Frame -> True,
Axes -> False]]
Bob Hanlon
---- Erik Max Francis <max at alcyone.com> 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?
Thanks.