The easiest and most natural thing is to add jitter to your plot.
Data setup:
using Random
Random.seed!(0)
N=2000
dat=DataFrame(x=rand(1:5,N),y=rand(1:5,N),z=rand(1:5,N))
Plotting:
scatter3d(dat.x+rand(N)./10 .- 0.2,
dat.y+rand(N)./10 .- 0.2,
dat.z+rand(N)./10 .- 0.2)
However, if you want to use the colors this still can be done:
dat2=combine(groupby(dat,[:x,:y,:z]),nrow)
Having processed the data now let’s make a colormap (you might want to adjust it differently):
using Colors
cols = range(colorant"red", stop=colorant"green", length=maximum(dat2.nrow))
Time to plot:
scatter3d(dat2.x, dat2.y, dat2.z, color=cols[dat2.nrow])
CLICK HERE to find out more related problems solutions.