You can increase the number of bins to reduce the granularity. But if you want it to be smooth you should make a distribution fit and 9plot the distribution with heatmap
I prefer to use Plots.jl in order to keep plot formatting (size, font, colorsâŚ). However, I am impressed of the plot speed with GR.
I explored two ways:
First one with heatmap as suggested:
#test heatmap
using KernelDensity
using Interpolations
using Plots
x = sort(randn(5000))
y = x * 2.3 + sort(randn(5000))
k = kde((x, y))
ik = InterpKDE(k)
z = pdf(ik, x, y)
heatmap(x, y, z, c = :vik)
savefig("./heatmap.png");
Second one with contourf:
#test contourf linewidth 0
using KernelDensity
using Plots
using StatsPlots
x = sort(randn(5000))
y = x * 2.3 + sort(randn(5000))
k = kde((x, y))
contourf(k,
c = :vik,
linewidth = 0)
savefig("./contourf.png");