Plots, How to save figure to the file with high resolution (dpi=300)?

When I use “scatter()” function with the parameter of “dpi”, the output figure looks strange.
On windows 7, Julia0.5.2, Plots v0.11.4, Python2.7, matplotlib v1.1.1

using Plots; using StatPlots;
pyplot( legend = true, dpi=300 )    
scatter( frm_container, :Gt, :Engine_KW_Total, dpi=300)
savefig( "d:\\figure1")

The saved figure looks strange, also not proper in Juno plots window

When the dpi is set to the small value, the figure shows correctly. For example, when I change the third line to

using Plots; using StatPlots;
scatter( frm_container, :Gt, :Engine_KW_Total, dpi=100)
savefig( "d:\\figure1")

But for the journal paper, the dpi should be above 300

I tranfered from Python to Julia. It is very easy in matplotlib, but i cannot find that in the document of Plots. Could any one help?

Hi @zhangliye, do you have a minimum working example so that we can try reproduce the issue?

Also, please share the Julia and Plots.jl versions that you are using:

julia> versioninfo()
julia> Pkg.status("Plots")

I tried PyPlot, and it is nearly the same as matplotlib.pyplot. It works quite well in PyPlot.

It is an excellent idea of Plots to make the same API for different plot packages. As a young package, the document and functions need to be improved. Thanks for the work of the two packages.

And where is the minimum working example?

The minimum example is as follows.

using DataFrames; using StatPlots;
df = DataFrame(a = 1:1000, b = 100*rand(1000))
scatter(df, :a, :b, dpi=300)  # when dpi=100, it show properly

savefig( "d:\\figure1")

If you set the size of the plot, it works:

using Plots, StatPlots, DataFrames
df = DataFrame(a = 1:1000, b = 100*rand(1000))
scatter(df, :a, :b, dpi=300, size=(2000,2000))

but feel free to open an issue on Plots.jl to get more feedback on this.

Also, consider updating to the current stable release of the language, which is Julia v0.6.

1 Like

Thanks for your reply!

I just tried. It is still not proper on my computer.
The same as before. I will open an issue to make sure if others have the same problem.
I have drawn the graph using PyPlot, and it works quite well.

It may be a problem on Julia v0.5 only, so make sure you specify the version of the language when you open the issue.

Thanks for your kind reminding.

There is no debugger for Julia0.6 (Gallium.jl is not ready for Julia0.6), and I thus still use Julia 0.5. I tracked Julia for a long time, and start considering it seriously and using it for the research project when Gallium.jl is released. Hope the debugger for Julia0.6 will be ready soon.

No problem :slight_smile:, you are welcome.

As a side comment, I am impressed about how many people rely on a debugger to code. I trained myself to reason through code with my brain, and in most cases it is very efficient!

The only time I needed a debugger in my life was when I was playing with heavy parallel programming on a cluster, in that case, debuggers are super valuable.