Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

By using Plot command I want to get one curve in form if circles and other like a solid line.

Plot[{Cos[x], Sin[x]}, {x, 0, 2 Pi},
      PlotStyle -> {Opacity[0]}, Mesh -> 30, MeshStyle -> {PointSize[Large], Blue}]

enter image description here

share|improve this question
up vote 6 down vote accepted

Edit: Michael E2 notes that style None should be used instead of Opacity[0] because the former avoids drawing the line while the latter simply makes it invisible. I have changed all styles in the code below accordingly.

There may be a syntax to use a different Mesh for each curve (I cannot recall) but if not you can always fall back to plotting separately and combining with Show:

 Plot[Cos[x], {x, 0, 2 Pi}, PlotStyle -> None, Mesh -> 30, 
   MeshStyle -> Directive[PointSize[Large], Blue]],
 Plot[Sin[x], {x, 0, 2 Pi}, PlotStyle -> Red]

enter image description here

Two more ways to write the same thing:

 Plot[#[x], {x, 0, 2 Pi}, ##2] & @@@
  {{Cos, PlotStyle -> None, Mesh -> 30, 
    MeshStyle -> Directive[PointSize[Large], Blue]},
   {Sin, PlotStyle -> Red}}

 Plot[#[x], {x, 0, 2 Pi}, #2] &,
 {Cos, Sin},
  {PlotStyle -> None, Mesh -> 30, MeshStyle -> Directive[PointSize[Large], Blue]},
  PlotStyle -> Red
share|improve this answer
It is nice to see how many questions that one has have been already asked and solved by other people! Mathematica syntax seems quite complex to me. I appreciate this website very much! – Vicent Jul 1 '14 at 12:58

[Works on V7-V10, Mac OSX.] Adapting my answer to the OP's other question, we can use PlotStyle to achieve the same effect with evenly spaced dots.

Plot[{Cos[x], Sin[x]},
 {x, 0, 2 Pi}, 
 PlotStyle -> {Directive[CapForm["Round"], Dashing[{0, 0.05}], Thickness[0.02]],

Mathematica graphics

Caveat: The CapForm["Round"] directive does not seem to be honored in Windows (at least with respect to Dashing in PlotStyle), according to a comment to my answer to the linked question.

Side notes: The setting PlotStyle -> {Opacity[0]} in the OP's example code produces a curve, a Line object in fact, that cannot be seen. The setting PlotStyle -> None causes Plot not to produce a Line object at all.

I've never been able to figure out how to apply different mesh specifications to different functions using one Plot. I do it in the way Mr. Wizard has shown.

share|improve this answer
Unfortunately your caveat is true: this does not work in v7 under Windows, though CapForm["Round"] works elsewhere. – Mr.Wizard Dec 26 '13 at 14:39
@Mr.Wizard Oh, bother, as Pooh says. – Michael E2 Dec 26 '13 at 14:44
Nice tip regarding PlotStyle -> None. – Mr.Wizard Dec 26 '13 at 14:46
"Oh, bother" I say that a lot too. :^) – Mr.Wizard Dec 26 '13 at 14:46
This is a perfect method; it's a shame that this has not been fixed in recent versions for Windows. I wonder if the back end graphics engine somehow doesn't support this. Do you know which APIs are used on your platform? – Mr.Wizard Dec 26 '13 at 14:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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