# BarLegend tick labels

I am doing a ListContourPlot of my data, but to achieve a solid plot I needed to first take a logarithm of the "height". Now I'd like to force the ticks on my BarLegend to certain values, but I have no idea how to do that.

To rephrase... I have a plot (seen on the picture), but I'd like to change the labels on the BarLegend, but I need them to remain where they are. To put it simply, I need to replace each TickLabel value with its exponential.

• mathematica.stackexchange.com/questions/215745/… Mar 7, 2022 at 19:54
• This lets me change the Ticks to specific ones, but not to make them evenly distributed even tho the values are scaled logarithmically Mar 7, 2022 at 20:26
• I am just guessing if you want something similar to this. you can always change the legend label. It's always best to post a minimal example the problem can be recreated. mathematica.stackexchange.com/questions/76168/… Mar 7, 2022 at 20:45

 data = Table[3 Sin[x] Cos[y], {x, 0, 2 Pi, 0.05}, {y, 0, 2 Pi, 0.05}];

ListContourPlot[data, ColorFunction -> "Rainbow",
Contours -> {Automatic, 30},
PlotLegends -> Placed[BarLegend[Automatic, None,
LegendLabel -> "Spectral Density"], Below]]


Add the option LabelingFunction -> (Exp[HoldForm @ #3] &) to BarLegend:

ListContourPlot[data, ColorFunction -> "Rainbow",
Contours -> {Automatic, 30},
PlotLegends -> Placed[BarLegend[Automatic, None,
LabelingFunction -> (Exp[HoldForm @ #3] &),
LegendLabel -> "Spectral Density"], Below]]


Note: To see the arguments of the pure function used to set LabelingFunction, inspect:

BarLegend[{"Rainbow", {-5, 5}}, None, LabelingFunction -> FOO]