9

Bug introduced in version 11.1 and fixed in 11.3.0


I think the bar legend custom ticks are automatically sorted in Mathematica 11.1. Am I making some stupid mistake here or is it a bug?


This is with MMA 11.1 Linux

BarLegend[{"Rainbow", {-1, 1}}, LegendLayout -> "Row",  Ticks -> {-1, 0, 1}]

enter image description here

If I try to put custom ticks

BarLegend[{"Rainbow", {-1, 1}}, LegendLayout->"Row",Ticks ->{{-1, "a"}, {0, "b"}, {1, "c"}}]

enter image description here

BarLegend[{"Rainbow", {-1, 1}}, LegendLayout->"Row",Ticks ->{{-1, "c"}, {0, "a"}, {1, "b"}}]

enter image description here

It is sorting the tick labels !!!


Now with MMA10.4 Linux

BarLegend[{"Rainbow", {-1, 1}}, LegendLayout->"Row",Ticks ->{{-1, "c"}, {0, "a"}, {1, "b"}}]

enter image description here

kglr
  • 394,356
  • 18
  • 477
  • 896
Sumit
  • 15,912
  • 2
  • 31
  • 73

1 Answers1

11

Looks like it is a bug. A work-around is to specify the labels using the option "TickLabels":

BarLegend[{"Rainbow", {-1, 1}}, LegendLayout -> "Row", 
  "Ticks" -> {-1, 0, 1}, "TickLabels" ->{"c","b","a"}]

Mathematica graphics

kglr
  • 394,356
  • 18
  • 477
  • 896