轴数相互干扰

Axes numbers interfere with each other

我在Mathematica 中有一个绘图,问题是:绘图的轴数相互干扰。如何消除中间数字,例如“5*10^12, 5*10^13, ...”并保留主要数字“1*10^12, 1*10^13, ...” .还有其他方法可以解决这个问题吗?

Plot

使用一个简单的例子,刻度可以像这样固定。参考代码来自 here and here.

首先,显示重叠标签的情况。

f[x_] := x^2 + x^3

{min, max} = {10^-12, 10^-10};

LogLogPlot[f[x], {x, min, max}, Frame -> True,
 BaseStyle -> 18, FrameLabel -> {"X", "Y"}]

正在删除备用标签。

xticks = Charting`ScaledTicks[{Log, Exp}][Log[min], Log[max]];
xticks[[All, 1]] = Exp@xticks[[All, 1]];
xticks[[All, 2]] = ReplacePart[xticks[[All, 2]],
   Thread[Select[Range@Length@xticks, EvenQ] -> Spacer[{0, 0}]]];

LogLogPlot[f[x], {x, min, max}, Frame -> True,
 FrameTicks -> {Automatic, {xticks, Automatic}},
 BaseStyle -> 18, FrameLabel -> {"X", "Y"}]

另一种选择是保留所有刻度标签并旋转它们:

xticks = Charting`ScaledTicks[{Log, Exp}][Log[min], Log[max]];
xticks[[All, 1]] = Exp@xticks[[All, 1]];
xticks[[All, 2]] = Rotate[#, Pi/2] & /@ xticks[[All, 2]];

LogLogPlot[f[x], {x, min, max}, Frame -> True, 
 FrameTicks -> {Automatic, {xticks, Automatic}}, BaseStyle -> 18, 
 FrameLabel -> {"X", "Y"}]