Consider the following plot.

enter image description here

Produced with this code:

ArrayPlot[{{1, 0, 0, 0.3}, {1, 1, 0, 0.3}, {1, 0, 1, 0.7}}, PlotLegends ->BarLegend[Automatic, LabelStyle -> Directive[Medium, Black]], ImageSize -> 500, FrameStyle -> Black]

I would like to be able to make the BarLegend edging/frame/axis and ticks a darker colour as the white part of the legend nearly blends into the white background of the plot. Analogous to the way FrameStyle has been used for the plot itself.

I was hoping for something like AxesStyle or FrameStyle to be an option for BarLegend. But these are not options.

I assume this functionality is there to do what I would like to achieve, but cannot find how to do it. I assume I am missing something obvious, but any help would be greatly received.


1 Answer 1


A couple of options:

ArrayPlot[{{1, 0, 0, 0.3}, {1, 1, 0, 0.3}, {1, 0, 1, 0.7}},
 PlotLegends ->
   LabelStyle -> {FontSize -> 12},
   LegendFunction -> "Panel",
   Method -> {TicksStyle -> {Black, AbsoluteThickness[1]}}],
 ImageSize -> 500,
 FrameStyle -> Black]

enter image description here

  • $\begingroup$ Thanks. The following nearly does it, but missed the left, top and bottom of the edging around the bar legend. Method -> {TicksStyle -> {Black, AbsoluteThickness[1]}, FrameStyle -> {Black, AbsoluteThickness[1]}}]} $\endgroup$
    – flyingmind
    Commented Jun 22 at 15:56

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.