Using Makie for Allotaxonometry

There was some discussion about a rotated inset axis recently, might be interesting for you:

If text! doesn’t work correctly with rotate! (which I don’t think it does) you should still be able to do things manually. If you rotate the whole scene (i.e. ax.scene or f.scene.children[1]) you can get the pixel position within that scene for a data position with px_pos = project(ax.scene, position). You can use that to plot text at the correct position by plotting to f.scene, which is in pixel units. You need to add the offset from ax.scene though, so it becomes

positions = Point2f[(1, 1), (2, 1), (3, 1)]

fig, ax, p = scatter(positions, color = [:red, :green, :blue])
rotate!(ax.scene, Vec3f(0,0,1), pi/4)
xlims!(ax, -0.5, 2.0)
ylims!(ax, 1, 3)

px_positions = map(positions) do pos
    Makie.project(ax.scene, pos) + minimum(ax.scene.px_area[])
end
text!(
    fig.scene, ["First", "Second", "Third"], position = px_positions, 
    color = [:red, :green, :blue], rotation = [0.0, pi/4, -pi/4]
)

fig

or

px_positions = map(ax.scene.camera.projectionview, ax.scene.px_area) do _, px_area
    map(positions) do pos
        Makie.project(ax.scene, pos) + minimum(px_area)
    end
end

to make the text positions update automatically.

1 Like