Julia Plots savefig whitespace issue

When saving figures generated by Plots.jl with the pyplot, is there a straightforward way to trim the extra whitespace when I call savefig?

1 Like

I do not know if there is a pure Julia solution, but you can crop the image with the convert command in linux using:

julia> run(`convert -trim in.png out.png`)

(input and output may have the same name as well).

1 Like

What if Iā€™m working with PDF instead of PNG?

Got it to work with the pdfcrop command line tool. Still, it would be nice if there were a way to get Plots.jl to tighten up figures.

2 Likes