I can’t figure out a reasonably simple answer to this, and I’d guess the must be one.
I want to create a
lines plot rotated 90 degrees. Like, everything rotated: axis, labels, curves, the whole thing. Here’s a minimum working example (I could make it simpler, but this also outlines a potential real-world scenario):
with_theme(theme_light()) do fig = Figure() ax_main = Axis(fig[1,1:2]) ax_side = Axis(fig[1,3], xlabel = "x label", ylabel = "y label") Xs = Ys = -10:0.1:10 contour!(ax_main, Xs, Ys, exp.((-Xs'.^2 .- Ys.^2)/25)) lines!(ax_side, Xs, exp.(-Xs.^2/25)) # <- This I want rotated on its side fig end
This produces the figure on the left in the picture attached below. What I want is - more or less - the figure on the right. Right now, in order to produce that rightmost figure, I’m manually flipping everything:
with_theme(theme_light()) do Xs = Ys = -10:0.1:10 fig = Figure() ax_main = Axis(fig[1,1:2]) ax_side = Axis(fig[1,3], ylabel = "x label", xlabel = "y label", flip_ylabel = true, yticks = (-10:5:10, string.(10:-5:-10))) contour!(ax_main, Xs, Ys, exp.((-Xs'.^2 .- Ys.^2)/25)) lines!(ax_side, exp.(-Xs.^2/25), reverse(Xs)) fig end
which I find extremely suboptimal: I have to switch everything x-related with everything y-related, I have to reverse the former-X-now-Y data, I have to manually create reversed y-axis ticks, because reversing the data is not enough (?), I have to flip the y-label, and more… It’s becoming even more cumbersome given that such plots are produced in many places in my code, and sometimes I want them displayed horizontally, others vertically, so I’d really like to have a common codebase for producing both varieties.
So, question is, is there some simple solution that I’m missing here? Like some
direction-like attribute or similar?