I am using StatsPlots package to perform basic plotting.
df = DataFrame(A = 1:10, B =rand(10))
@df df plot(:A, :B)
it returns a plot file like below as I expected.
Is there anyway I can save this plot image into my machine(Ubuntu) as a file?
A Plot is only displayed when returned (a semicolon will suppress the return), or if explicitly displayed with display(plt) , gui() , or by adding show = true to your plot command.
pyplot. imsave() method, we may save the plot to an image file rather than using Matplotlib to display it.
Sure you can:
using StatsPlots, DataFrames
df = DataFrame(A = 1:10, B =rand(10))
plotd = @df df StatsPlots.plot(:A, :B);
savefig(plotd,"file.png")
Also note that other extension are available. The savefig
documentation reads:
"All backends support png and pdf file types, some also support svg, ps, eps, html and tex."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With