具有较大 xtick 标签编号的 JuliaLang 图显示为科学记数法和畸形指数中的数字过多

JuliaLang plot with large xtick label numbers is displayed with too many figures in scientific notation and malformed exponent

我正在使用 Plots.jl 和默认的 GR() 绘图后端而不是来自 JuliaLang 的 pyplot。 x 轴刻度数以千为单位,生成的系列图使用科学记数法 wiki examples 在 x 轴上显示这些数字。给出了太多的小数点,这是可以理解的,因为选择的轴点是由程序设置的,但即使对于 1.00000x10,这些尾随零也会被打印出来。下面是一个例子,在求幂中产生了一个错误。这怎么能解决。甚至更改了 fontfamily 以查看是否删除了效果但它仍然存在。 (xticks=1:step:final)

您可以使用 xformatter 更改刻度的格式 (source):

using Plots
let n_samples = 80,
    d = Plots.fakedata(n_samples,1),
    i = collect(1:n_samples) .* 1e10
    plot(i,d, 
         xformatter = x->string(Int(x/1e10),"*pow10"))
end

这似乎不在文档中。