I have a big iteration process and I want to look at the trajectories. Although if I consider ParametricPlot for this process, Mathematica connects points with lines. And for

ParametricPlot[{Re[Exp[100*I*t]], Im[Exp[100*I*t]]}, {t, 0, 1000}, PlotStyle -> Thin]

instead of a circle I am getting this: enter image description here

Is there any way to just draw points? there is a version DiscretePlot but this is 3Dimensional feature.

Thank you!

  • $\begingroup$ Graphics@Point@Table[{Re[Exp[100*I*t]], Im[Exp[100*I*t]]}, {t, 0, 1000}] $\endgroup$ – Simon Rochester Jul 12 '15 at 8:25
  • $\begingroup$ or ParametricPlot[{Re[Exp[100*I*t]], Im[Exp[100*I*t]]}, {t, 0, 1000}, MeshStyle -> PointSize[Small], Mesh -> All, PlotStyle -> None] $\endgroup$ – Simon Rochester Jul 12 '15 at 8:46
  • $\begingroup$ To get a more reliable plot you can also try increasing the PlotPoints option. In your example you need it quite high but it works. Try for example ParametricPlot[ {Re[Exp[100*I*t]], Im[Exp[100*I*t]]}, {t, 0, 1000}, PlotStyle -> Thin, ImageSize -> Large, PlotPoints -> 3000 ]. Higher values of PlotPoints decrease the thickness of the resulting circle. $\endgroup$ – glS Jul 12 '15 at 9:56
  • $\begingroup$ ListPlot[Table[{Re[Exp[100*I*t]], Im[Exp[100*I*t]]}, {t, 0, 1000, .01}], AspectRatio -> 1] or ListPlot[{Re[Exp[100*I*#]], Im[Exp[100*I*#]]} & /@ Range[0, 1000, .01], AspectRatio -> 1] $\endgroup$ – Bob Hanlon Jul 12 '15 at 13:04
  • $\begingroup$ Note that the reason that you're not getting a circle in this case is that Mathematica isn't using enough plot points; "adjacent" points appear to be halfway around the circle from each other, and so the connecting lines are much more visible. Increasing PlotPoints gives the expected results. (To get a good result it needs to be around 10000, which does take noticeably longer to plot.) $\endgroup$ – Michael Seifert Jul 15 '15 at 19:06

I'll summarize the answers presented in the comments, so the question appears answered to interested future users, in the spirit of this laudable Meta post from Ian.

The most direct answer to your question, i.e. preventing ParametricPlot from drawing connecting lines, was provided by Simon Rochester:

parplot = ParametricPlot[
 {Re[Exp[100*I*t]], Im[Exp[100*I*t]]}, {t, 0, 1000},
 MeshStyle -> PointSize[Small], Mesh -> All, PlotStyle -> None

Simon's ParametricPlot

Adaptive sampling leads to the use of more than 3k points for the plot above, as glance noted as well:

Length@First@Cases[parplot, Point[a_List] -> a, Infinity]
(* Out: 3108 *)

Simon also suggested to construct the plot directly from Graphics primitives. Below is that suggestion, adjusted to have roughly the same number of plot points as the ParametricPlot above, as well as to show the axes:

 Point@Table[{Re[Exp[100*I*t]], Im[Exp[100*I*t]]}, {t, 0, 1000, 0.322}],
 Axes -> True

The result is visually indistinguishable from that of the ParametricPlot above.

Bob Hanlon's suggested approaches using ListPlot, applied to a table generated by Mapping a pure function on a Range, or using Table. The two approaches are perfectly equivalent, and I personally find the Table a bit more readable. Again, I adjusted the $t$ step to fall in line with the examples above.

 Table[{Re[Exp[100*I*t]], Im[Exp[100*I*t]]}, {t, 0, 1000, .322}],
 AspectRatio -> Automatic

It is interesting to compare timings for these approaches (these were obtained using RepeatedTiming):

ParametricPlot :  0.025   s
Graphics       :  0.00047 s
ListPlot/Table :  0.030   s
ListPlot/Range :  0.031   s

In short, constructing the plot directly from Graphics primitives seems to be TWO orders of magnitude faster (!!) than the *Plot approaches. I may have expected that the magic going on under the hood in ParametricPlot would slow that one down, but such a marked difference between Graphics@Point and the comparatively "dumber" ListPlot was quite unexpected to me.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.