Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

up vote 9 down vote accepted

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

share|improve this answer
Why bother with CurrentValue? It works just fine without it, i.e use Graphics[{Rectangle[]}], instead. –  rcollyer Aug 22 '12 at 2:10
add comment

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.