1
$\begingroup$

I have written the code below:

ListPlot[das1, PlotMarkers -> {\[FilledCircle], 12}, 
 PlotStyle -> {Black}, Joined -> True, Mesh -> All, MeshStyle -> Red, 
 PlotLegends -> 
 Placed[Style[#, FontSize -> 20] & /@ {"6.7 ps"}, {Top, Right}]]

I want a black line to go through my red data points. Then, I want the plot legend to be red.

However, by using the above code I get a black plot legend.

enter image description here

How can I set the plot legend color independent of the plot itself?

How can I extend the solution to multiple graphs in one plot?

$\endgroup$

1 Answer 1

5
$\begingroup$

One way would be by using PointLegend:

ListPlot[Range[10], PlotMarkers -> {\[FilledCircle]}, 
 PlotLegends -> 
  Placed[PointLegend[{Red, Green}, 
    Style[#, FontSize -> 20] & /@ {"A", "B"}], {Top, Right}], 
 PlotStyle -> {Black}, Joined -> True, Mesh -> All, MeshStyle -> Red]

enter image description here

$\endgroup$
0

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.