# How to keep markers as dots in a joined ListPlot?

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

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

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

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)...

-
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

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}}];

ListPlot[data,
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.

ListPlot[data,
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.

-

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]}


-
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]


-
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]


+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