0
$\begingroup$

I am using Mathematica 11.1 and facing difficulty with BarLegend. When I specify custom ticks using "Ticks" and custom tick labels using "TickLabels", BarLegend is still sorting ticks in a strange way. I have, for example:

"Ticks"->{-10,-7.5,-5.,-2.5,0.},"TickLabels"->{"-10","-7.5","-5.","-2.5","0."}

But the Bar Legend shows up with something like this instead:

{-7.5,-5.,-2.5,0.,-7.5,-10.}

I have no idea what could be causing this. There is another post that deals with this issue here Problem with custom ticks in BarLegend in Mathematica 11.1, however, even explicitly specifying the tick labels via "TickLabels" isn't working.

Furthermore, both options "Ticks" and "TickLabels" show up in red highlights and are not being 'fully' recognised as options for BarLegend. I know that these options do work for positive numbers but the moment my z range contains negative numbers the BarLegend gets mixed up. This happens even when I convert the tick labels to strings before passing them to BarLegend.

**The same thing happens even when I try to shift the tick range so that it contains only positive numbers.

$\endgroup$
  • 7
    $\begingroup$ This is nothing. Here is a true BarLegend bug $\endgroup$ – Daniel Lichtblau Jul 9 '17 at 21:12
  • $\begingroup$ Works correctly in MMA11.1 Linux, BarLegend[{"Rainbow", {-10, 0}}, LegendLayout -> "Row", "Ticks" -> {-10, -7.5, -5., -2.5, 0.}, "TickLabels" -> {"-10", "-7.5", "-5.", "-2.5", "0."}] $\endgroup$ – Sumit Jul 10 '17 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.