如何在朱莉娅中保存情节?

How to save plot in julia?

我正在使用 StatsPlots 包来执行基本绘图。

df = DataFrame(A = 1:10, B =rand(10))
@df df plot(:A, :B)

它 returns 如我所料,如下所示的绘图文件。

无论如何我可以将这个绘图图像作为文件保存到我的机器(Ubuntu)中吗?

当然可以:

using StatsPlots, DataFrames
df = DataFrame(A = 1:10, B =rand(10))
plotd = @df df StatsPlots.plot(:A, :B);
savefig(plotd,"file.png")

另请注意,还有其他扩展可用。 savefig 文档内容如下:

"All backends support png and pdf file types, some also support svg, ps, eps, html and tex."