Re: same plot for continous and discrete function
- To: mathgroup at smc.vnet.net
- Subject: [mg29627] Re: same plot for continous and discrete function
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Fri, 29 Jun 2001 01:36:00 -0400 (EDT)
- References: <9hetgb$6jr$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Yackov,
There is no single built-in function to do what you want.
I hope that you will find the following useful.
Please look up terms used in the Help Browser (select the word and use menu
>Help> Find selected function ( or press F1 in Windows).
Allan Hayes
Here is a plot of a continuous function - note the use of options to style
the plot.
gr1= Plot[Sin[x],{x,0, 2Pi},PlotStyle\[Rule] {Thickness[.04], Hue[.7]}]
The symbol gr1 is assigned the graphics object Out[8] (not the display) as
its value.
Here is a list of coordinates.
lst= Table[{x, Cos[x]},{x,0,2Pi, Pi/5.0}]
Here is a plot derived from the list:
gr2 = ListPlot[lst, PlotJoined\[Rule]True,
PlotStyle\[Rule] {Thickness[.02], Hue[0]}]
Show is used to show graphics objects together:
gr3=Show[gr1,gr2, Frame\[Rule]True, Axes\[Rule]False]
We can make out own graphics objects and add them in
Show[gr3, Graphics[{Hue[.3],PointSize[.05],Point/@lst}]
]
Sometimes we may want to construct parts without showing them
gr1nd= Plot[Sin[x],{x,0, 2Pi},PlotStyle\[Rule] {Thickness[.04], Hue[.7]},
DisplayFunction\[Rule]Identity]
gr2nd = ListPlot[lst, PlotJoined\[Rule]True,
PlotStyle\[Rule] {Thickness[.02],
Hue[0]},DisplayFunction\[Rule]Identity]
Then show them together with the display turned back on:
Show[gr1nd,gr2nd, Frame\[Rule]True, Axes\[Rule]False,
DisplayFunction\[Rule]$DisplayFunction]
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Martin Harborth" <martin.harborth at ts.siemens.de> wrote in message
news:9hetgb$6jr$1 at smc.vnet.net...
> -----Ursprüngliche Nachricht-----
> Von: Yackov_Shermann [SMTP:yackov at mangocrafts.com]
> Gesendet am: Donnerstag, 21. Juni 2001 22:02
> An: Harborth Martin
> Betreff: Multiple Plots
>
>
> Hello.
>
> This is my very first exposure to Mathematica and I can't quite figure out
> how to get on the same plot, both a continuous function y=F(x) and a
> discrete one yi=G(xi) (actually, a list of {xi, yi}), provided both share
> the same definition domain.
> Is there a built-in primitive for a such task?
>
> Yackov
>
>
> ------------------------------
> http://MangoCrafts.com
> ------------------------------
> Experience... Everything!!
>
>
>
>
>