Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Apparently, BarLegend in version 10 displays tick legends in scientific notation when they are smaller in magnitude than 0.01. For instance,

BarLegend[{"Rainbow", {-.015, .015}}, 
LabelStyle -> Directive[Black, Bold, FontSize -> 12]]

creates the object

enter image description here

How can I change the tick labels to decimal notation, as they would have appeared in version 9?

By the way, the Bold directive evidently is being ignored. Is there a work-around for this?

share|improve this question
2  
Just had a look at examples in the docs and LabelStyle looks very buggy. You shouldn't need to explicitly use FontSize, the number should be sufficient -- but it is not. As you say Bold is not recognised, nor is FontWeight->Bold. –  Mike Honeychurch Jul 17 at 22:28
1  
Seems to work OK in 10.0.1 –  Sjoerd C. de Vries Sep 17 at 13:51
    
@Sjoerd Confirmed. –  Mr.Wizard Sep 17 at 14:05

1 Answer 1

up vote 12 down vote accepted

Two work-arounds:

(1) Use TickLabels

BarLegend[{"Rainbow", {-0.015, 0.015}}, ImageSize->300,
  Charting`TickLabels -> 
  (Style[NumberForm[#, {Infinity, 3}],Bold,Black,12] & /@ Range[-.015, .015, .005])]

enter image description here

(2) Use LabelingFunction:

BarLegend[{"Rainbow", {-0.015, 0.015}}, ImageSize->300, 
    LabelingFunction -> (Style[NumberForm[#, {Infinity,3}],Bold, Black,12] &)]
(* same picture *)

Note: Just to make the labels Bold the option combination BaseStyle->Directive[Bold,12], LabelStyle->Black also works.

share|improve this answer
    
Despite the fact that Mathematica flags ImageSize, BaseStyle, LabelingFunction, and Charting`TickLabels as unknown option names, both of your recommendations work well. Thanks, @kguler. –  bbgodfrey Jul 18 at 14:17
    
@bbgodfrey, thank you for the accept. –  kguler Jul 18 at 22:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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