MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Dotted Plots

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104484] Re: [mg104446] Re: [mg104432] Dotted Plots
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sun, 1 Nov 2009 17:54:31 -0500 (EST)
  • References: <200910310653.BAA13285@smc.vnet.net> <15199945.1257067727012.JavaMail.root@n11>

The problem with dotted lines is to get the dots evenly spaced. Maybe there
is a simpler way, but it seems to me we have to use an Automatic AspectRatio
and then deal with a curve parametrization in terms of arc length. Since
Murray gives a specific curve example, I'll try that. (In general it may not
be so easy.)

curve[t_] := {t, Sin[t]}

The velocity of the curve is:

v[t_] = Simplify[Norm[curve'[t]], t \[Element] Reals]
Sqrt[1 + Cos[t]^2]

The arc length function of the curve is:

s[t_] = Integrate[v[u], {u, 0, t}, Assumptions -> {0 < t < 2 \[Pi]}]
Sqrt[2] EllipticE[t, 1/2]

The length of the curve to the first zero is:

s[\[Pi]] // N
3.8202

We then calculate t[s] by writing dt/ds and solving numerically.

ClearAll[t];
First@NDSolve[{t'[s] == 1/Sqrt[1 + Cos[t[s]]^2], t[0] == 0}, 
   t, {s, 0, 4}];
t[s_] = t[s] /. %
InterpolatingFunction[{{0.,4.}},<>][s]

A unit-speed parametrization is then:

unitspeed[s_] = curve[t[s]]

{InterpolatingFunction[{{0.,4.}},<>][s],Sin[InterpolatingFunction[{{0.,4.}},
<>][s]]}

Finally, a dotted curve plot.

pts = Table[unitspeed[t], {t, 0, 3.8, 3.8202/40}];
ListPlot[pts, PlotStyle -> Directive[Black, PointSize[0.01]],
 AspectRatio -> Automatic]

But in this case the regular parametrization is not too bad:

pts = Table[{x, Sin[x]}, {x, 0, Pi, Pi/40.}];
ListPlot[pts, PlotStyle -> Directive[Black, PointSize[0.01]],
 AspectRatio -> Automatic]

So that's the problem with dotted curves.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  


From: Murray Eisenberg [mailto:murray at math.umass.edu] 


This may be merely an artifact of how a "dot" is displayed using pixels.

You might try ListPlot instead to see if you get better results. For 
example:

   pts = Table[{x, Sin[x]}, {x, 0, Pi, Pi/100.}];
   ListPlot[pts, PlotStyle -> PointSize[0.005]]

Robert Rosenbaum wrote:
> In regards to my first e-mail, asking about how to make a dotted  
> plot.  I received several suggestions to use Dotted or Dashing[{0, r}].
> 
> The Mathematica manual says:
> "If a segment has a length ri specified as 0, it is drawn as a dot  
> whose diameter is the thickness of the line."
> 
> However, when I try this I just get small dashes.  That is, the dashes  
> are rectangular, not circular.
> I'm using 7.0.0 on a mac.  Is anyone able to get circular dots?

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305




  • Prev by Date: Re: SetDelayed and Evaluate
  • Next by Date: Re: Problem with Screen Environment
  • Previous by thread: Re: Dotted Plots
  • Next by thread: Re: plotting with dotted lines, not dashed