How to set the color of plot legend independent of the plot itself

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.

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?



1 Answer


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]