Control the tick marks in BarLegend

It looks like BarLegend takes Ticks as an undocumented option. With a helper function:

makeTicks[range_, num_] := Rescale[#, {1, num}, range] & /@ Range[num]

BarLegend[{"SolarColors", MinMax[data]}, Ticks -> makeTicks[MinMax[data], 7]]

Mathematica graphics

For more control, a more complicated function can be used:

makeTicks2[range_, num_] := 
 MapIndexed[{#1, 
    NumberForm[#1, If[(#2[[1]] == 1 || #2[[1]] == num), 2, 1]]} &, 
  Rescale[#, {1, num}, range] & /@ Range[num]]

BarLegend[{"SolarColors", MinMax[data]}, 
 Ticks -> makeTicks2[MinMax[data], 7]]

Mathematica graphics


Maybe

SeedRandom[36]
data = RandomReal[{-0.5, 1}, 10];

vals = Select[FindDivisions[MinMax@data~Join~{0.2}, 6], 
     IntervalMemberQ[Interval@MinMax@data, #] &]~Join~MinMax[data] // 
   Sort;

ticks = Transpose[{vals, NumberForm[#, 2] & /@ vals}];

BarLegend[{"SolarColors", MinMax[data]}, Ticks -> ticks]

enter image description here