# How to change List Contour Plot to log log scale?

I would like to draw a ListContourPlot in Log Log scale as well as bar legend. But I have no idea about how to do it. Could anyone help me to draw the plot in Log Log scale?

ListContourPlot[ConfVar, InterpolationOrder -> 2, PlotLegends ->
BarLegend[Automatic, LegendLabel -> "sin \!$$\*SubscriptBox[\(\[Theta]$$, $$12$$]\)"],
ContourStyle -> None, Frame -> True]


And the result is a below plot.

Functions and coefficients for this plot are

\[Alpha]em = 1/137

mmu = 102.8/1000

F[x_] := (5*x^4 - 14*x^3 + 39*x^2 - 38*x - 18*x^2*Log[x] + 8)/(12*(1 - x)^4)

\[CapitalGamma]totalmu = 3*10^-19

Brmutoe\[Gamma]expmax = 4.2*10^-13

imax = 10^5

ConfVar = {};
For[i = 1, i <= imax, i++,
MZprimer = RandomReal[{100, 1000}];
s12r = RandomReal[{10^-5, 10^-1}];
valf1 = MZprimer;
valf3 = s12r;
If[valf4 < Brmutoe\[Gamma]expmax, {ConfVar =
Join[ConfVar, {{valf1, valf2, valf3}}]}]]


Many thanks for someone's help in advance.

• Look at the ScalingFunctions option. For example ScalingFunctions -> "Log10" – David Keith Feb 8 at 18:36
• @DavidKeith Thanks for your suggestion, but when I tried that method, the y-axis of this plot is from 10^-5 to 1. But I need the y-axis to be from 10^-3 to 1. How can I fix that problem? – lhcQFT Feb 8 at 18:46
• @lhcQFT by using the PlotRange->{{xmin,xmax},{ymin,ymax},{zmin,zmax}} option... – bjorn Feb 8 at 19:02
• @lhcQFT Parameter is not defined  [CapitalGamma]totalmu – Alex Trounev Feb 8 at 19:03
• @bjorn Thanks, I will try it. – lhcQFT Feb 8 at 19:10

I have not been able to generate data from your code, but here is an example with fake data:

lst = Flatten[
Table[{x, y, 1 + (Sin[x] + 10) Exp[-(x - 2)^2 - (y - 3)^2]},
{x, 2, 4, .1}, {y, 2, 4, .1}],
1];

ListContourPlot[lst, PlotLegends -> Automatic]


ListContourPlot[lst, PlotLegends -> Automatic,
ScalingFunctions -> {"Log10", "Log10", "Log10"}]


• @DaividKeith Thank you for your example. I forgot to write down one important information in my text and edited it. But is there a better way to express bar legend like 10^-n rather than arbitrary number? – lhcQFT Feb 8 at 19:30
• @ihcQFT Sorry, I do not know a way to do this. There might well be a way, but I find the behavior of ListContourPlot quite strange when trying to specify contours with a Log scale. Perhaps someone else will point the way. – David Keith Feb 8 at 20:36

If you have the right dynamic range in the data, it will scale appropriately. Otherwise, you can put your own numbers into the PlotLegends field.

PlotLegends -> BarLegend[10^-Range[5]


You can specify the frame ticks (numbers along the axes) with FrameTicks[]. For example, if the default output was not to our liking, we could have achieved the same result with

FrameTicks -> {{10^Range[2], None}, {10.0^Range[2], None}}]


As mentioned in the comments, use PlotRange[] to specify the range of values.

Putting it all together ...

ListContourPlot[ConfVar, InterpolationOrder -> 2,
PlotLegends -> BarLegend[10^-Range[5],
LegendLabel -> "sin $$\*SubscriptBox[\(\[Theta]$$, $$12$$]\)"],
ContourStyle -> None, Frame -> True,
ScalingFunctions -> {"Log10", "Log10", "Log10"},
FrameTicks -> {{10^Range[-3, 0], None}, {10.0^Range[3], None}},
PlotRange -> {Automatic, {10^-3, 1}, Automatic}]