13

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. enter image description here

Is there anyway I can save this plot image into my machine(Ubuntu) as a file?

Mohamed Thasin ah
  • 10,754
  • 11
  • 52
  • 111
  • 2
    Perhaps different backend, but there is file saving: https://www.tutorialkart.com/julia/save-plot-png-jpeg-julia/ – Evgeny Jul 19 '20 at 16:05

1 Answers1

22

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."

Przemyslaw Szufel
  • 40,002
  • 3
  • 32
  • 62