Mathematica 中对数图刻度线的指数形式
为了了解更多 Mathematica,我尝试重现此 上的刻度线对数(对数)图:
这是我所能得到的最接近的结果:
LogLogPlot[Log[x!], {x, 1, 10^5}, PlotRange -> {{0, 10^5}, {10^-1, 10^6}}, Ticks -> {Table[10^i, {i, 0, 5}], Table[10^i, {i, -1, 6}]}]
问题
如何为适当的 n 值制作始终为 10^n 形式的刻度线?
In an attempt to learn more Mathematica, I am trying to reproduce the tick marks on this log (log) plot:
This is as close as I can get:
LogLogPlot[Log[x!], {x, 1, 10^5}, PlotRange -> {{0, 10^5}, {10^-1, 10^6}}, Ticks -> {Table[10^i, {i, 0, 5}], Table[10^i, {i, -1, 6}]}]
Question
How can I make tick marks that are always of the form 10^n for appropriate values of n?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Superscript
,没有任何内置含义的通用排版形式,是您的朋友。Superscript
, the generic typesetting form without any built-in meaning, is your friend for this.要扩展前面的答案,您可以通过执行以下操作自动计算
Ticks
选项中Table
的正确范围To expand on the previous answers, you can calculate the right range for the
Table
s in theTicks
option automatically by doing something likeLevelScheme
是 Mathematica 的一个包,它使得制作此类图非常容易简单、完全可定制且外观专业。我非常确定,如果您的绘图是在 mathematica 中制作的,那么它是使用 LevelScheme 的。这是我使用LevelScheme
在 Mathematica 中复制的图LevelScheme
is a package for Mathematica that makes making such plots very easy, fully customizable and professional looking. I'm very certain that if your plot was made in mathematica, it was using LevelScheme. Here's my reproduction of your plot in Mathematica usingLevelScheme
您可以通过提供
{value, label}
的 2 元组来指定给定刻度的标签,而不是仅提供value
。这仍然给我们留下了如何维护
10^n
形式的难题。为此,我们观察到使用
Defer
使10^i
保留其形式。但是,我们仍然需要评估
i
在里面,否则我们只会得到一堆10^i
-标签。示例:
使用这个,我们现在可以执行以下操作来获得解决方案:
You can specify the label for a given tick, by giving a 2-tuple of
{value, label}
instead of giving just giving avalue
.This still leaves us with the conundrum of how to maintain the
10^n
-form.To do this, we observe, that using
Defer
makes the10^i
retain its form. However, we still need toEvaluate
thei
inside of it, as otherwise we just get a bunch of10^i
-labels.Example:
Using this, we can now do the following to get a solution: