One suggestion using Plots.jl, is to display the data via colored rotated rectangles. The result looks like a rotated heatmap for practical purposes:
Plots.jl gr() code (no bells & whistles)
using ColorSchemes, Plots; gr(dpi=600)
import ColorSchemes.viridis
rotx(x,y,α) = x*cosd(α) - y*sind(α)
roty(x,y,α) = x*sind(α) + y*cosd(α)
function rectangle(x, y, w, h, α)
X, Y = [0,w,w,0], [0,0,h,h]
Shape(x .+ rotx.(X,Y,α), y .+ roty.(X,Y,α))
end
# 1 - INPUT DATA
α = 45.0
x1, x2 = -150, 150
y1, y2 = -80, 80
w, h = 4.0, 2.0
xc, yc = -w/2 .+ range(x1, x2, step=w), -h/2 .+ range(y1, y2, step=h)
cp = Iterators.product(xc,yc)
Xc, Yc = first.(cp), last.(cp)
Xr, Yr = rotx.(Xc,Yc,α), roty.(Xc,Yc,α)
Z = sin.(hypot.(Xr,Yr)/10) # some function of (x,y)
# 2- PLOT ROTATED HEATMAP
zc = (Z .- minimum(Z))/(maximum(Z) - minimum(Z)) # normalize extrema to (0,1)
Cz = get.(Ref(viridis), zc) # compute RGB colors
clims = extrema(Z)
heatmap(xc, yc, NaN*Z, ratio=1, clims=clims, frame=:none, legend=:outerright)
for (x, y, c) in zip(Xr,Yr,Cz)
plot!(rectangle(x, y, w, h, α), c=c, lw=0.1, lc=c);
end
xaxis = [-w/2 + x1, w/2 + x2]
yaxis = [-h/2 + y1, h/2 + y2]
xt, yt = LinRange(x1, x2, 9), LinRange(y1, y2, 9)
Xxt, Yxt = rotx.(xt, yaxis[1] .+ zero(xt), α), roty.(xt, yaxis[1] .+ zero(xt), α)
Xyt, Yyt = rotx.(xaxis[1] .+ zero(yt), yt, α), roty.(xaxis[1] .+ zero(yt), yt, α)
Xx, Xy = rotx.(xaxis, yaxis[1] .+ [0,0], α), roty.(xaxis, yaxis[1] .+ [0,0], α)
Yx, Yy = rotx.(xaxis[1] .+ [0,0], yaxis, α), roty.(xaxis[1] .+ [0,0], yaxis, α)
c = (y2-y1)/(x2-x1)
dX, dY = c*[diff(Xx)[], diff(Xy)[]]/10, [diff(Yx)[], diff(Yy)[]]/10
for (x,y) in zip(Xxt,Yxt)
plot!([x, x - dY[1]/3], [y, y - dY[2]/3], lc=:black)
end
for (x,y) in zip(Xyt,Yyt)
plot!([x, x - dX[1]/3], [y, y - dX[2]/3], lc=:black)
end
plot!(Xx, Xy, lc=:black, lw=1)
plot!(Yx, Yy, lc=:black, lw=1)
annotate!(Xxt .- dY[1], Yxt .- dY[2], text.(string.(round.(xt, digits=1)), 5, rotation=α, "Computer Modern"))
annotate!(Xyt .- dX[1], Yyt .- dX[2], text.(string.(round.(yt, digits=1)), :right, 5, rotation=α, "Computer Modern"))
Plots.current()