8
$\begingroup$

Bug introduced in 11.1 and persisting through 11.2.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

$\endgroup$
8
$\begingroup$

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

$\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.