如何使用绘图 (Julia) 使 x 轴和 y 轴变粗?

Mir*_*vic 5 plot julia julia-plots

如何使 Julia 图中 x 轴和 y 轴的线条更粗?有没有一种简单的方法可以实现这一目标?

微量元素:

using Plots

Nx, Ny = 101,101
x = LinRange(0, 100, Nx)
y = LinRange(0, 100, Ny)

foo(x,y; x0=50, y0=50, sigma =1) = exp(- ((x-x0)^2 + (y-y0)^2)/(2*sigma^2)  )
NA = [CartesianIndex()]  # for "newaxis"
Z = foo.(x[:,NA], y[NA,:], sigma=10);

hm = heatmap(x, y, Z, xlabel="x", ylabel="y", c=cgrad(:Blues_9), clim=(0,1))
plot(hm, tickfontsize=10, labelfontsize=14)
Run Code Online (Sandbox Code Playgroud)

导致: 电流输出

到目前为止我发现的帖子表明这是不可能的:

  1. https://discourse.julialang.org/t/plots-jl-modify-frame-thickness/24258/4
  2. https://github.com/JuliaPlots/Plots.jl/issues/1099

还这样吗?

我的情节的实际代码要长得多。我不想在不同的绘图库中重写所有内容。

hck*_*ckr 3

目前,Plots.jl 中似乎没有轴厚度的属性。

作为解决方法,您可以使用 属性thickness_scaling,它将缩放所有内容的厚度:线、网格线、轴线等。由于您只想更改轴的厚度,因此需要缩小其他轴的厚度。这是使用 pyplot 后端执行此操作的示例代码。

using Plots
pyplot() # use pyplot backend

Nx, Ny = 101,101
x = LinRange(0, 100, Nx)
y = LinRange(0, 100, Ny)

foo(x,y; x0=50, y0=50, sigma =1) = exp(- ((x-x0)^2 + (y-y0)^2)/(2*sigma^2)  )
NA = [CartesianIndex()]  # for "newaxis"
Z = foo.(x[:,NA], y[NA,:], sigma=10);

hm = heatmap(x, y, Z, xlabel="x", ylabel="y", c=cgrad(:Blues_9), clim=(0,1))
plot(hm, tickfontsize=10, labelfontsize=14) # your previous plot

# here is the plot code that shows the same plot with thicker axes on a new window
# note that GR backend does not support `colorbar_tickfontsize` attribute
plot(hm, thickness_scaling=2, tickfontsize=10/2, labelfontsize=14/2, colorbar_tickfontsize=8/2, reuse=false)

Run Code Online (Sandbox Code Playgroud)

有关绘图属性的更多信息,请参阅Julia 绘图文档。