I am making a discrete plot and a regular function plot together. But my curve is so thick that for color-blind people, it's pretty much impossible to see the black dots of my discrete plot:

plot1 = ParametricPlot[{Sin[t], Cos[ t]}, {t, 0, 2 Pi}, 
   PlotStyle -> {Red, Thickness[0.01]}];

plot2 = ListPlot[Table[{Sin[n], Cos[n]}, {n, 50}], 
   PlotRange -> {-1, 1}];

Show[plot1, plot2]

combined plot

I tried adding "thickness" parameter, but it didn't work.

  • $\begingroup$ Look up PlotMarkers in the documentation. You can set the size and shape and also use a graphics primitive. See this for more: mathematica.stackexchange.com/q/2214/5 $\endgroup$ – rm -rf Oct 4 '12 at 4:38
  • $\begingroup$ @rm-rf We are starting to answer in comments. This is crazy. We should set up a policy. $\endgroup$ – Dr. belisarius Oct 4 '12 at 4:48
  • $\begingroup$ @rm-rf, okay I tried doing ListPlot[Table[{Cos[n], Sin[ n]}, {n, 50}], PlotMarkers -> {Table[{Cos[n], Sin[ n]}, {n, 50}], Large}] but it isn't giving me dots. So I switched to "PlotMarkers -> Automatic" and it worked! But I seem to have no control over the size $\endgroup$ – Hawk Oct 4 '12 at 4:55
  • $\begingroup$ @belisarius I just left a hint for some of the newer users to attempt answering (or for OP himself to read up on the docs and answer)... not for Mr.Wizard. $\endgroup$ – rm -rf Oct 4 '12 at 5:23
  • $\begingroup$ @rm-rf :))))))) $\endgroup$ – Dr. belisarius Oct 4 '12 at 5:41

I recommend using Graphics primitives for this kind of application, which gives you direct (and usually easier) control of appearance. As a bonus performance is usually better as well.

For simple applications such as this, if you don't also need the plots separately, you can use Epilog in ParametricPlot to insert these primitives:

ParametricPlot[{Sin[t], Cos[t]}, {t, 0, 2 Pi}, 
  PlotStyle -> {Red, Thickness[0.01]}, 
  Epilog -> {PointSize[Large], Point@Table[{Sin[n], Cos[n]}, {n, 50}]}

Mathematica graphics

See documentation for PointSize and AbsolutePointSize for complete control of point size.

If you need the plots separately you can do that too, like this:

p1 = ParametricPlot[{Sin[t], Cos[t]}, {t, 0, 2 Pi}, 
       PlotStyle -> {Red, Thickness[0.01]}

p2 = Graphics[
       {PointSize[Large], Point @ Table[{Sin[n], Cos[n]}, {n, 50}]},
       PlotRange -> {-1, 1}

Show[p1, p2]

In a comment J. M. reminds us that this form for p2 also works:

p2 = ListPlot[Table[{Sin[n], Cos[n]}, {n, 50}], PlotStyle -> {Black, PointSize[Large]}];

My recommendation to use graphics primitives is so that more complicated styles are within reach and so that code may be shared between Graphics and Epilog. Perhaps I am complicating things for such a simple operation and you would prefer that.

  • $\begingroup$ That's interesting. I just opened up the Epilog page on Mathematica. I have no idea what it says nor do I think the command explanation tells me anyway that it plots dots for me. $\endgroup$ – Hawk Oct 4 '12 at 4:58
  • $\begingroup$ @jak You must understand Graphics, PointSize, and Point as well. Epilog allows you to overlay primitives such as Point on top of the result of ParametricPlot. See this documentation and ask for clarifications where you have trouble. $\endgroup$ – Mr.Wizard Oct 4 '12 at 5:01
  • $\begingroup$ Yeah I definitely will. Thank you $\endgroup$ – Hawk Oct 4 '12 at 5:04
  • $\begingroup$ @jak, thanks for Accepting my answer (green check-mark), but please consider waiting 24 hours. This gives other people a chance to answer before the topic appears concluded. $\endgroup$ – Mr.Wizard Oct 4 '12 at 5:07
  • 1
    $\begingroup$ I prefer the Epilog route, but for the second method, having p2 = ListPlot[Table[{Sin[n], Cos[n]}, {n, 50}], PlotStyle -> PointSize[Large]] works just as well. $\endgroup$ – J. M.'s ennui Oct 4 '12 at 9:39

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.