4
$\begingroup$
ListLinePlot[Table[Sin[x + j], {j, {1, 4}}, {x, 1, 10, 0.1}], 
 PlotMarkers -> {"●", "○", "□", "◇"}, ImageSize -> Medium]

Works but when I introduce Mesh->50 the markers do not change

ListLinePlot[Table[Sin[x + j], {j, {1, 4}}, {x, 1, 10, 0.3}], 
 PlotMarkers -> {"●", "○","□", "◇"}, Mesh -> 30, ImageSize -> Medium]
$\endgroup$
1
  • $\begingroup$ This works as expected. ListPlot[Table[Sin[x + j], {j, {1, 4}}, {x, 1, 10, 0.3}], PlotMarkers -> {"\[EmptyCircle]", "\[EmptySquare]"}, Joined -> True, ImageSize -> Medium] $\endgroup$ Apr 29, 2019 at 2:52

2 Answers 2

4
$\begingroup$

You can post-process the output of ListLinePlot to modify the Insets:

postProcess[markers_] := Module[{insets, 
    directives = Cases[#, {___, d_Directive, _Line} :> d, All]},
   insets = Inset[#, {0, 0}] & /@ (Style @@@ 
     Transpose[{Take[markers, Length@directives], directives}]); 
   # /. GeometricTransformation[i_, c_] :> 
    (GeometricTransformation @@@ Thread[{insets, Transpose@GatherBy[c, #[[1, 1]] &]}])] &

pmarkers = {"●", "○", "□", "◇"};

ListLinePlot[Table[Sin[x + j], {j, {1, 4}}, {x, 1, 10, 0.1}], 
  PlotMarkers -> pmarkers, ImageSize -> Medium, Mesh -> 30] // 
 postProcess[pmarkers]

enter image description here

$\endgroup$
2
  • $\begingroup$ Yes It works but i think it is a bug that they cannot work together directly $\endgroup$
    – XinBae
    Apr 3, 2019 at 11:55
  • $\begingroup$ @xinpei write to Wolfram support and suggest that $\endgroup$
    – b3m2a1
    Apr 3, 2019 at 16:36
0
$\begingroup$

I find a simple solution. But sometimes there are wrong shown points. Use Mesh -> {Range[1, 100, 3]} to set the x of mesh points.

ListLinePlot[Table[Sin[x + j], {j, {1, 3, 2, 4}}, {x, 1, 10, 0.1}], PlotMarkers -> {"\[FilledCircle]", "\[EmptyCircle]", "\[EmptySquare]", "\[EmptyDiamond]"}, Mesh -> {Range[1, 100, 3]}, ImageSize -> Medium]

$\endgroup$

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.