Skip to main content
formated code
Source Link
Karsten7
  • 27.6k
  • 5
  • 74
  • 135

In below simple graph, if an opacity is specified in the legendmarkers, the plot marker shifted a little bit, can someone please shed some lights?

Plot[{Sin[x], Cos[x]}, {x, 0, Pi}, PlotLegends -> {Placed[ PointLegend[{Directive[Red, Opacity[0.8]], Blue}, TextCell[#, TextAlignment -> Left] & /@ {"ABC", "XYZ"}, LegendMarkers -> {{\[FilledSquare], 22}, {\[FilledSquare], 22}}], {0.5, 0.5}]}]

Plot[{Sin[x], Cos[x]}, {x, 0, Pi}, 
 PlotLegends -> {Placed[PointLegend[{Directive[Red, Opacity[0.8]], Blue}, 
     TextCell[#, TextAlignment -> Left] & /@ {"ABC", "XYZ"}, 
     LegendMarkers -> {{\[FilledSquare], 22}, {\[FilledSquare], 22}}], {0.5, 0.5}]}]

enter image description here

In below simple graph, if an opacity is specified in the legendmarkers, the plot marker shifted a little bit, can someone please shed some lights?

Plot[{Sin[x], Cos[x]}, {x, 0, Pi}, PlotLegends -> {Placed[ PointLegend[{Directive[Red, Opacity[0.8]], Blue}, TextCell[#, TextAlignment -> Left] & /@ {"ABC", "XYZ"}, LegendMarkers -> {{\[FilledSquare], 22}, {\[FilledSquare], 22}}], {0.5, 0.5}]}]

enter image description here

In below simple graph, if an opacity is specified in the legendmarkers, the plot marker shifted a little bit, can someone please shed some lights?

Plot[{Sin[x], Cos[x]}, {x, 0, Pi}, 
 PlotLegends -> {Placed[PointLegend[{Directive[Red, Opacity[0.8]], Blue}, 
     TextCell[#, TextAlignment -> Left] & /@ {"ABC", "XYZ"}, 
     LegendMarkers -> {{\[FilledSquare], 22}, {\[FilledSquare], 22}}], {0.5, 0.5}]}]

enter image description here

Source Link
Leonx
  • 413
  • 2
  • 9

Why legendmarkers shifted a few pixels after opacity is specified

In below simple graph, if an opacity is specified in the legendmarkers, the plot marker shifted a little bit, can someone please shed some lights?

Plot[{Sin[x], Cos[x]}, {x, 0, Pi}, PlotLegends -> {Placed[ PointLegend[{Directive[Red, Opacity[0.8]], Blue}, TextCell[#, TextAlignment -> Left] & /@ {"ABC", "XYZ"}, LegendMarkers -> {{\[FilledSquare], 22}, {\[FilledSquare], 22}}], {0.5, 0.5}]}]

enter image description here