[Date Index]
[Thread Index]
[Author Index]
Re: Plot: Problem with Mesh Option
*To*: mathgroup at smc.vnet.net
*Subject*: [mg102702] Re: [mg102661] Plot: Problem with Mesh Option
*From*: Bob Hanlon <hanlonr at cox.net>
*Date*: Wed, 19 Aug 2009 07:03:51 -0400 (EDT)
*Reply-to*: hanlonr at cox.net
timevector = Range[0, 10]/10;
pts = {#, Sin[#]} & /@ timevector;
Or use Epilog instead of Mesh
Plot[Sin[t], {t,
First[timevector], Last[timevector]},
Epilog -> {PointSize[Large], Red, Point[pts]}]
Or use ListLinePlot
ListLinePlot[pts,
PlotMarkers -> Graphics[{Red,
PointSize[Large], Point[{0, 0}]}],
PlotStyle -> Blue]
Or use graphics primitives
Graphics[{Blue, Line[pts],
Red, PointSize[Large], Point[pts]},
Axes -> True,
AspectRatio -> 1/GoldenRatio]
Bob Hanlon
---- Benjamin Hell <hell at exoneon.de> wrote:
=============
Hi,
I'm currently stuck on figuring out how to display the full mesh when
manually defining it via passing a list of points, which looks like this:
timevector = Table[0.1*i, {i, 0, 10}];
Plot[Sin[t], {t, First[timevector], Last[timevector]},
Mesh -> {timevector}, MeshStyle -> Directive[PointSize[Large], Red]]
The whole thing works as expected, but the first and the last point of
the mesh, which correspond to {0,Sin[0]} and {1,Sin[1]} in the example
above, don't show up. So how can I fix that?
Here is my further investigation:
- The points of course do show up if I increase the time interval on
both sides, let's say {t, First[timevector]-0.1, Last[timevector]+0.1}
but this is not a proper solution to me.
- Workarounds that do work:
1.Manually inserting the points in the Graphics output via a
new Graphics object (not that nice):
Show[
Plot[Sin[t], {t, First[timevector], Last[timevector]},
Mesh -> {timevector}, MeshStyle -> Directive[PointSize[Large],
Red]],
Graphics[{PointSize[Large], Red,
Point[{First[timevector], Sin[First[timevector]]}],
Point[{Last[timevector], Sin[Last[timevector]]}]}]
]
2.Using ParametricPlot instead of Plot (the best solution I
found):
ParametricPlot[{t, Sin[t]}, {t, First[timevector],
Last[timevector]},
Mesh -> {timevector}, MeshStyle -> Directive[PointSize[Large],
Red]]
Thanks in advance,
Benjamin
Prev by Date:
**Re: Plot Table of functions does not distinguish colors**
Next by Date:
**Re: Plot: Problem with Mesh Option**
Previous by thread:
**Re: Plot: Problem with Mesh Option**
Next by thread:
**Re: Plot: Problem with Mesh Option**
| |