I have some density plots and an "advise". What does it mean? " I also strongly recommend switching the color scales in this figure from linear to log, to make it even easier to see the region of instability." What is the Log color scale? How can I do this? Note that, I think this is different with a density plot with logarithmic scales iv axis. Tnx.
$\begingroup$
$\endgroup$
dp1 = DensityPlot[x^2 + y^2, {x, 10, 100}, {y, 10, 100},
ColorFunction -> "Rainbow", ImageSize -> 250 ] ;
In DensityPlot[f, ...]
the argument of func
in ColorFunction > func
is the f
. So using the option ScalingFunctions -> {None, None, "Log"}
makes the coloring logarithmic.
dp2 = DensityPlot[x^2 + y^2, {x, 10, 100}, {y, 10, 100},
ColorFunction -> "Rainbow",
ScalingFunctions -> {None, None, "Log"}, ImageSize -> 250] ;
Alternatively, you can use scaled ColorFunction
together with the option ColorFunctionScaling -> False
to get the same result.
dp3 = DensityPlot[x^2 + y^2, {x, 10, 100}, {y, 10, 100},
ColorFunction -> (ColorData[{"Rainbow", {Log@200, Log@20000}}][
Log@#] &), ColorFunctionScaling -> False, ImageSize -> 250];
Row[{dp1, dp2, dp3}]
-
$\begingroup$ Does it related to the colors only? Or effects on the axis scales too? In fact, I have some negative values of the function in the density plot. Is it possible to have a logarithmic scaling yet?! $\endgroup$ – Perfect Fluid Jun 23 '18 at 13:27
-
1$\begingroup$ @PerfectFluid, it does not affect the axes scales. Color function argument is the scaled value of the function
f
in the first argument ofDensityPlot
; so usingLog
scaling on thef
values only changes the values supplied toColorFunction
. With negative and zero values you can't use log scaling (i think those values will be cropped.) Based on the graphs in your other question, I think the referee's suggestion doesn't make much sense. $\endgroup$ – kglr Jun 23 '18 at 13:39 -
-
$\begingroup$ Dear @kglr, I just installed a higher version of Mma, and
scaling functions
is active now. However, some parts of the density plot are white! I have tested the points of this region and did not equal to zero. What is the reason of this white area?! $\endgroup$ – Perfect Fluid Jun 23 '18 at 14:32 -
$\begingroup$ @perfectfluid: be sure that you enable PlotRange->Full, if not mathematica cuts out parts of your result that it deems too large or too small to fit on the plot. $\endgroup$ – ptaels Oct 17 '19 at 11:59
ColorFunction
option to change the scaling. E.g., you can useColorFunction -> ColorData["DarkRainbow"]@*Log10
, whereColorData["DarkRainbow"]
stands for just any color function. $\endgroup$ – Henrik Schumacher Jun 23 '18 at 13:18