Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

Consider the following typical interactive sequence. First I produce a ListPlot:

enter image description here

OK, not bad, but I want those dots to be bigger, and also joined. First, I make the dots bigger, like this:

enter image description here

Good. Next, to join the dots, I do this:

enter image description here

Aaaarrrrrgh! The dots disappeared! Why??? Don't they know anything about usability at WRI?

I have tried to achieve the desired effect in a bazillion ways, and they all fail for one reason or another: either the dots no longer look like dots (but rather like diamonds, squares, triangles), or they are no longer the same color as the lines joining them, or something else...

So my question is: how can I achieve the simple effect of several plots of (distinctly visible) dots joined by lines, and each plot of a different, but uniform, color?

I also have a meta-question: The frustration illustrated by the interaction above is entirely typical of my experience with Mathematica, since day 1. I used to think that the reason why I had such difficulty getting the simplest things done with Mathematica was that I just didn't know it well enough... But this problem has persisted over the years, with hardly any improvement, even though I've devoted considerable effort to learning more and more about Mathematica. I have been using Mathematica now for about 20 years (!), and I still struggle for hours at a time with trivialities like this one. This makes me wonder whether these difficulties are really more a reflection with a fundamental flaw in some aspect of Mathematica's design (one that somehow makes conceptually simple things turn out to be disproportionately difficult). Sure, when one is starting out with some new software simple things may take a long time to accomplish, but Mathematica is the only software that I've been using for more than, say 4-5 years, and that I still have to struggle with for hours to get simple things to work (and very often I just have to give up with)...

share|improve this question
About your meta-question, there was identical discussion here about something similar but I cand find it. There was no conclusion :) Some find those issues "features" the others "bugs". I believe the oryginal discussion was about not plotting automatically alle the values for given domain. – Kuba Sep 7 '13 at 22:59
I would be surprised if anyone found the fact that Joined -> True, Mesh -> All draws every point in blue instead of the corresponding line's colour to be a "feature" and not a "bug". – Rahul Sep 8 '13 at 0:02
@RahulNarain In this case I would call it bug, but it is not always so obvious, there are many different "features" out there :). – Kuba Sep 8 '13 at 0:10
fyi, can also use the new command ListLinePlot for this. No difference for this case. ListLinePlot[data, ImageSize -> 700, PlotMarkers -> {Automatic, 12}] !Mathematica graphics – Nasser Sep 8 '13 at 2:16
up vote 18 down vote accepted

The PlotMarkers option is designed to handle this problem. Here are two very simple ways to do it using that option.

data = Table[Table[Sin[k x], {x, 0, 2 Pi, 0.1}], {k, {1, 2, 3}}];

  Joined -> True,
  PlotMarkers -> {Automatic, 7}]


The above solution has a drawback: there can be a slight misalignment of the markers, because they're rendered as text. See this question for a detailed discussion.

  Joined -> True,
  PlotMarkers -> Graphics@{Disk[{0, 0}, Scaled@0.01]}]


Note: it might seem that wrapping Disk with List is unnecessary, but that is not the case. Without the wrapper, the points will alll be black. See this question for more detail.

share|improve this answer

This is a duplicate but I can't find it, meanwhile:

ListPlot[Table[Table[Sin[k x], {x, 0, 2 Pi, 0.1}], {k, {1, 2, 3}}], 
         PlotStyle -> PointSize@.01, Joined -> True
        ] /.  Line[x_, y___] :> {Point[x], Line[x, y]}

enter image description here

share|improve this answer
Thanks! Once again, I feel some remorse after choosing one of two excellent answers... – kjo Sep 8 '13 at 2:00
@kjo I think you have chosen well, I would accept m_goldberg's solution too. Modifying PlotMarkes is neatter then postprocessing :) – Kuba Sep 8 '13 at 7:43

Here is low-level solution for this problem which guarantees exact positioning of graphics primitives:

data = Table[Table[{x, Sin[k x]}, {x, 0, 2 Pi, 0.1}], {k, 3}];

Graphics[MapIndexed[{ColorData[1]@@ #2, Line@#1, 
    PointSize[Medium], Point@#1} &, data], Axes -> True, 
 AspectRatio -> 1/GoldenRatio]


share|improve this answer
Very simple, and very cool! – kjo Sep 8 '13 at 12:46
data = Table[Sin[k x], {k, 3}, {x, 0, 2 Pi, 0.1}];
ListLinePlot[data,  Mesh -> All]

  ListLinePlot[#, Mesh -> All, PlotStyle -> {PointSize@.012, #2}] &,
   {data, ColorData[1, "ColorList"]~Take~3}] // Show

enter image description here

share|improve this answer
+1 for finally correcting that nested Table thing! – Mr.Wizard Sep 8 '13 at 7:07
@Mr.Wizard: I had not noticed that until reading your comment. FWIW, the original was cut-and-pasted directly from the Options>PlotStyle section of the documentation page for ListPlot... – kjo Sep 8 '13 at 12:41
@kjo Sorry if I offended you; I did not mean to. Rather, I couldn't believe that nobody before chyanog bothered to give the cleaner code for that. Unfortunately the documentation examples are not always written in the best style IMO. – Mr.Wizard Sep 8 '13 at 14:02
@Mr.Wizard: oh, I took no offense at all, so no worries. My comment was posted more as a curiosity than as anything else, and for those who, like me, may need to be reminded not to take the docs as holy scripture... :) – kjo Sep 8 '13 at 14:10

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.