TransWikia.com

Minor Log ticks on X-axis of DensityPlot

Mathematica Asked by Shawn Young on February 10, 2021

Could anyone help me to add the minor Log ticks to the X-axis of this Plot? Thank you so much!

DensityPlot[
 20*y/(0.2 y + 0.8 x), {x, 1/10^10, 1/10^2}, {y, 1/10^9, 1/10^6}, 
 ScalingFunctions -> {"Log", "Log"}, Ticks -> {Automatic}, 
 ColorFunction -> "Rainbow"]

I’ve tried many ways but none of them worked out. I’m still learning this. Thank you.enter image description here

One Answer

dp = DensityPlot[20*y/(0.2 y + 0.8 x), {x, 1/10^10, 1/10^2}, {y, 1/10^9, 1/10^6}, 
   ScalingFunctions -> {"Log", "Log"}, ColorFunction -> "Rainbow"];

Post-process dp to change the default number of major and minor ticks ({6,6}) to {8,6} for the bottom and top frames:

Replace[dp, {vt : {_, _}, {bt : Charting`ScaledTicks[{Log, Exp}], 
    tt_}} :> {vt, {bt[#, #2, {8, 6}] &, tt[#, #2, {8, 6}] &}}, All]

enter image description here

Alternatively,

{leftticks, rightticks} = #[{Log, Exp}][Log[1/10^9], Log[1/10^6], {6, 6}] & /@ 
    {Charting`ScaledTicks, Charting`ScaledFrameTicks};
{bottomticks, topticks} = #[{Log, Exp}][Log[1/10^10], Log[1/10^2], {8, 6}] & /@
    {Charting`ScaledTicks, Charting`ScaledFrameTicks};

Show[dp, FrameTicks -> {{leftticks, rightticks}, {bottomticks, topticks}}]

enter image description here

Answered by kglr on February 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP