3
$\begingroup$
xrange = {-1, 1};
xdata = {{1, 0., 1}, {1, 0, 1}, {1, 0, 1}, {1, 0, 1}, {1, 0, 1}};
ListLinePlot[Append[#\[Transpose], Total[#, {2}]] &[xdata], DataRange -> 
MinMax[xrange],PlotMarkers -> {{"\!\(\*TemplateBox[{\nCell[\n\
TextData[\"\\\\[FivePointedStar]\"]], \
\"paclet:ref/character/FivePointedStar\"},\n\"RefLink\",\n\
BaseStyle->{\"InlineCharacterName\"}]\)", 
Scaled[0.03]}, {"\!\(\*TemplateBox[{\nCell[\n\
TextData[\"\\\\[EmptyUpTriangle]\"]], \
\"paclet:ref/character/EmptyUpTriangle\"},\n\"RefLink\",\n\
BaseStyle->{\"InlineCharacterName\"}]\)", 
Scaled[0.03]}, {"\!\(\*TemplateBox[{\nCell[\n\
TextData[\"\\\\[EmptyCircle]\"]], \
\"paclet:ref/character/EmptyCircle\"},\n\"RefLink\",\n\
BaseStyle->{\"InlineCharacterName\"}]\)", 
Scaled[0.03]}, {"\!\(\*TemplateBox[{\nCell[\n\
TextData[\"\\\\[EmptySquare]\"]], \
\"paclet:ref/character/EmptySquare\"},\n\"RefLink\",\n\
BaseStyle->{\"InlineCharacterName\"}]\)", Scaled[0.03]}}, 
PlotLegends -> {"1", "2", "3", "4"}, Frame -> True, GridLines -> None]
ListLinePlot[Append[#\[Transpose], Total[#, {2}]] &[xdata], 
DataRange -> MinMax[xrange], 
PlotMarkers -> {{Automatic, Scaled[0.02]}, {Automatic, 
Scaled[0.03]}, {Automatic, Scaled[0.03]}, {Automatic, 
Scaled[0.03]}}, PlotLegends -> {"1", "2", "3", "4"}, 
Frame -> True, GridLines -> None]

horizontal lines at 0.0, 1.0, and 2.0; but you can't see that there are actually five lines

The data of "1" and "3" in the picture are the same, I need to differentiate them, so I use specific markers like this, but the color of the lines that share the markers are different from the markers. I want to make them the same. So I use "Automatic", the color of the lines that share the markers are the same with the markers, but the a new problem is that now the data "1" are covered by "3".

still can't see that there are actually five graphs So how to solve it?


Update

After studying the grammar of PlotMarkers and comparing the difference between my code that express markers and the answer's, I find the problem of my previous code is that I use some unnecessary code. For example, mine is

"\!\(\*TemplateBox[{\nCell[\n\TextData[\"\\\\[FivePointedStar]\"]],  \\"paclet:ref/character/FivePointedStar\"},\n\"RefLink\",\n\ BaseStyle-> 
{\"InlineCharacterName\"}]\)"

And the answer's is

 "\[FivePointedStar]"

And mine is markers copy from the documentation directly. If I write it by myself like

"\[FivePointedStar]"

Then I can control it.

$\endgroup$

1 Answer 1

4
$\begingroup$

You can play with the size of each marker this way {MarkerName,Size}

xrange = {-1, 1};
xdata = {{1, 0., 1}, {1, 0, 1}, {1, 0, 1}, {1, 0, 1}, {1, 0, 1}};
ListLinePlot[Append[Transpose[#], Total[#, {2}]] &[xdata], 
 DataRange -> MinMax[xrange], 
 PlotMarkers -> {{"\[FivePointedStar]", 25}, {"\[FilledUpTriangle]", 
    20}, {"\[FilledCircle]", 10}, {"\[FilledSquare]", 20}}, 
 PlotLegends -> {"1", "2", "3", "4"}, Frame -> True, 
 GridLines -> None, ImageSize -> 500]

Example

$\endgroup$
1
  • $\begingroup$ Thank you for your answer.I am inspired by your answer,and I change the "FivePointedStar" to "Circle[]//Graphics" and adjust the size,the effect is better to differantiate the data.Thank you again $\endgroup$
    – wallfacer
    May 29, 2021 at 4:29

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.