2
$\begingroup$

I have a ListDensityPlot with argument PlotLegends -> Placed[BarLegend[Automatic], Below]. It produces an output like the following:

Can an argument be passed to BarLegend that changes its outline colour? In particular, I want it to be Black, rather than Gray.

$\endgroup$
2
  • 3
    $\begingroup$ try Placed[BarLegend[Automatic, FrameStyle -> Black], Below]? $\endgroup$
    – kglr
    Sep 23 at 6:11
  • $\begingroup$ @kglr many thanks - this works. I get an 'unknown option name' warning when I do this, though. Any idea why? If you want to write your comment as an answer I can mark this question answered. $\endgroup$ Sep 23 at 12:46

1 Answer 1

4
$\begingroup$

Follow the advice by @kglr, we use PlotLegends -> Placed[{FrameStyle -> Directive[Black, Thick]}, Below] since the default legend of ListDensityPlot is the barlegend.

ListDensityPlot[
 Table[x + Sin[3 x + y^2], {x, -3, 3, 0.1}, {y, -3, 3, 0.1}], 
 ColorFunction -> Function[{f}, ColorData["BrownCyanTones"][f]], 
 PlotLegends -> 
  Placed[{FrameStyle -> Directive[Black, Thick]}, Below]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.