3

I want to customize the frame and ticks of the BarLegend, but according to the documentation it does not support standard Graphics options. Perhaps there is a hack possible?

More specifically I want the frame and ticks to be with a fixed AbsoluteThickness and Black.

When testing, I figured out that although in conflict with documentation

BarLegend[{"SolarColors", {0, 1}}, 5, 
 FrameStyle -> Directive[Red, Thick], 
 TicksStyle -> Directive[Red, Thick]]

enter image description here

does actually change the colour and thickness of the frame, but not the thickness of the tick. How to also change the thickness of the tick?

kglr
  • 394,356
  • 18
  • 477
  • 896
Johu
  • 4,918
  • 16
  • 43
  • 1
    does BarLegend[{"SolarColors", {0, 1}}, 5 , "TicksStyle" -> Directive[ Red, FontColor->Black, AbsoluteThickness[5]], "FrameStyle" -> Directive[Red, Thick]] work in your version /OS? – kglr Aug 28 '18 at 19:32
  • Yes, it works and I would accept this as an answer. How do you discover " " options? – Johu Aug 28 '18 at 19:43
  • 2
    Johu, as I was searching where else I used "TicksStyle" i found How can I change the thickness of tick marks in BarLegend? which looks like a duplicate/ almost duplicate. It probably was during one of those spelunking expeditions where I bumped into Charting`iBarLegend and Options[Charting`iBarLegend] . – kglr Aug 28 '18 at 21:52
  • I agree, it is a dublicate. I really did try to search before my question. – Johu Aug 29 '18 at 00:00

1 Answers1

5
BarLegend[{"SolarColors", {0, 1}}, 5, 
  "TicksStyle" -> Directive[ Red, FontColor -> Black, AbsoluteThickness[5]], 
  "FrameStyle" -> Directive[Red, Thick]]

enter image description here

This works in version 9 / Windows 10 and version 11.3 / Wolfram Cloud.

kglr
  • 394,356
  • 18
  • 477
  • 896