RE: Show command.
- To: mathgroup at smc.vnet.net
- Subject: [mg45381] RE: [mg45379] Show command.
- From: "David Park" <djmp at earthlink.net>
- Date: Mon, 5 Jan 2004 03:50:57 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
George,
The problem is that you confused the letter l with the number 1. Fix that
and it works.
This could all probably be drawn more conveniently with
dat = {{1, 3}, {2, 12}, {3, 22}, {4, 35}, {5, 70}, {6, 95}, {7, 119}};
a = Fit[dat, x, x]
b = Fit[dat, {1, x, x^2}, x]
Needs["Graphics`Colors`"]
Plot[{a, b}, {x, -2, 9}, PlotStyle -> {Blue, Black},
Epilog -> {PointSize[0.02], Point /@ dat},
Frame -> True];
It is often easier to map Point onto a data list than to use ListPlot. If
you want to use ListPlot and, say, plot the two curves over different
domains you could try the DrawGraphics package at my web site below.
Needs["DrawGraphics`DrawingMaster`"]
Draw2D[
{PointSize[0.02], ListDraw[dat],
Draw[b, {x, 1, 7}],
Blue, Draw[a, {x, -2, 9}]},
Frame -> True];
ListDraw and Draw work just like ListPlot and Plot except that they extract
the primitive graphics and don't produce side plots.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: George [mailto:gtsavdar at auth.gr]
To: mathgroup at smc.vnet.net
I enter the following:
----------------------------------------------------------------------------
-
dat = {{1, 3}, {2, 12}, {3, 22}, {4, 35}, {5, 70}, {6, 95}, {7, 119}};
p = ListPlot[dat, PlotStyle -> PointSize[0.02]]
a = Fit[dat, x, x]
b = Fit[dat, {1, x, x^2}, x]
pl = Plot[a, {x, -2, 9}]
p2 = Plot[b, {x, -2, 9}]
Show[p,p1,p2]
----------------------------------------------------------------------------
-
Fit finds the requested things, Listplot and the 2 Plot draw the plots,
BUT Show[p,p1,p2] don't show anything. Well actually it shows the error
message:
Show::gcomb: An error was encountered in combining the graphics objects
in Show[p1, .Graphics]. More...
Why Show[p,p1,p2] don't show p,p1,p2?