3
$\begingroup$

When I try to add a bar legend to a log-scale ListDensityPlot, a decimal point appears at the weird position.

For example,

ListDensityPlot[Table[Power[10, -(i + j)/25], {i, 0, 100}, {j, 0, 100}], PlotRange -> All, PlotLegends -> Automatic, ScalingFunctions -> "Log"]

produces a legend

Decimal point presenting after the number 10.

No matter what I try (as far as I know), this weird decimal point after '10' never disappears and even the ScientificForm doesn't work as expected. How can I deal with this issue?

$\endgroup$
3
  • $\begingroup$ Sorry, but I am a bit confused as to why is that a problem? $\endgroup$ Commented Mar 16 at 9:42
  • $\begingroup$ @Erosannin When I try to use scientific notation, it converts '0.001' to '1.x10^-3' but doesn't convert '10.^-6' into '1.x10^-6'. If I force it to convert every numberform then it converts '10.' into '1.x10^1', thus yielding '1.x10^1-6'. I mean the placing of decimal point is inconsistent. $\endgroup$ Commented Mar 16 at 10:09
  • $\begingroup$ Related: here, here $\endgroup$ Commented Mar 16 at 22:41

1 Answer 1

3
$\begingroup$

Here's how you can avoid that

ListDensityPlot[Table[Power[10, -(i + j)/25], {i, 0, 100}, {j, 0, 100}],
  PlotRange -> All, 
 PlotLegends -> 
  BarLegend[{Automatic, {10^-8, 10^4}}, 
   Ticks -> 
    Table[{10^i, 
      ToString[Superscript["10", i], StandardForm]}, {i, -8, 4, 2}], 
   ColorFunctionScaling -> True], ScalingFunctions -> "Log"]      

image

$\endgroup$
1
  • $\begingroup$ Thank you! I've solved this immediate problem, but it's sad that the only way is to set the ticks manually. $\endgroup$ Commented Mar 16 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.