I would like to rotate a heatmap around a given line in a 3d scene.
So far rotate!(plt, qrotation(Vec3([0, 1, 0]), pi)) works great but I can only rotate against the x,y,z axis. How can I rotate with respect to a translated axis?
I already found this question about rotating plots but there was no solution for my problem
I don’t think the transformation system lets pick an origin for a rotation. But you can build your own model matrix to translate the heatmap, then rotate it, then translate it back:
model =
Makie.translationmatrix(axis_origin) *
Makie.rotationmatrix(qrotation(axis, angle)) *
Makie.translationmatrix(-axis_origin)
plt.model[] = model
(If that doesn’t work you may need to pass the model matrix when you create the plot. I vaguely remember some issue there.)
Alternatively you can define your heatmap so that it rotates the way you want (i.e. heatmap(-1…1, -1…1, data) if you want to rotate around the center) and then rotate and translate with the normal system. The order of operations there is always rotation first, scale and translation after.