I would like to make colored scatter plots where the dots are connected by lines. I have tried the following, using Joined->True to connect the dots and Mesh->Full to actually show the dots. I have tried using both PlotStyle and MeshStyle to color the lines and dots, respectively:

data1 = {{0, 1}, {1, 2}, {2, 3}};
data2 = {{0, 2}, {1, 3}, {2, 4}};
data3 = {{0, 3}, {1, 4}, {2, 5}};

ListPlot[{data1, data2, data3}, PlotRange -> All, Joined -> True, 
 Mesh -> Full, PlotStyle -> {Red, Green, Blue}, MeshStyle -> {Red, Green, Blue}]

which gives


Why are all of the dots blue? I would like their colors to match those of the lines (data1 should be red, data2 should be green, and data3 should be blue). Is this possible? Thank you!


1 Answer 1


You can use PlotMarkers instead of Mesh and use an explicit graphics primitive for the marker.

ListLinePlot[{data1, data2, data3}, PlotRange -> All, PlotStyle -> {Red, Green, Blue},
    PlotMarkers -> {Graphics[{Rectangle[]}], 0.04}]

enter image description here

  • 1
    $\begingroup$ Why bother with CurrentValue? It works just fine without it, i.e use Graphics[{Rectangle[]}], instead. $\endgroup$
    – rcollyer
    Aug 22, 2012 at 2:10
  • $\begingroup$ Using PlotMarkers also has the advantage that they work with legends (legends were not yet built in at the time when this post was written). $\endgroup$
    – Szabolcs
    Aug 6, 2015 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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