Plot: Problem with Mesh Option
- To: mathgroup at smc.vnet.net
- Subject: [mg102661] Plot: Problem with Mesh Option
- From: Benjamin Hell <hell at exoneon.de>
- Date: Tue, 18 Aug 2009 06:06:45 -0400 (EDT)
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
- Follow-Ups:
- Re: Plot: Problem with Mesh Option
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: Plot: Problem with Mesh Option