在 Plots.jl 中的图例标签之间增加 spacing/padding

Increase spacing/padding between legend labels in Plots.jl

我正在使用 Plots.jl 和 GR 后端在 JuliaLang 中生成一些图。我注意到当使用 LaTeXStrings.jl 在图例标签中生成 Latex 字符串时,标签靠得很近。为了说明我指的是什么,我编辑了 JuliaPlots linestyle example 以在图例标签中使用 Latex 字符串。代码如下:

using Plots; gr()
using LaTeXStrings

styles = filter((s->begin
            s in Plots.supported_styles()
        end), [:solid, :dash, :dot, :dashdot, :dashdotdot])

styles = reshape(styles, 1, length(styles))
n = length(styles)
y = cumsum(randn(20, n), dims = 1)

plot(y, line = (5, styles), label = [L"s^{ol}_{id}" L"d^{as}_h" L"d^{o}_{t}" L"d^{ash}_{dot}" L"dash^{dot}_{dot}"], legendtitle = "linestyle")

以上代码生成以下图:

如您所见,一个标签的下标与正下方标签的上标非常接近。图例标题也是如此。

我想增加每个标签之间的 spacing/padding 以便每个标签的 super- 和 sub-scripts 之间有一个间隙,但不知道该怎么做。

更高级的图例格式似乎仅适用于 pyplot() 后端。 但是,在使用 gr() 时,我有时会使用这个非常丑陋的技巧:

plot(y, line = (5, styles), label = [L"^{s^{ol}_{id}}" L"^{d^{as}_h}" L"^{d^{o}_{t}}" L"^{d^{ash}_{dot}}" L"^{dash^{dot}_{dot}}"],legendtitle = "linestyle",legendfontsize=14.0)