I am trying to create a waterfall plot (stacked line plot) in Makie.jl as shown in the attached image (Fig1.jpg).
I already know how to apply offsets to the lines to create the waterfall effect. However, I am struggling with how to add a secondary vertical axis on the right side to represent the “Emission Angle”.
In my case:
Left y-axis: Intensity (with offsets).
Right y-axis: Emission Angle (the parameter that distinguishes each line).
Could anyone point me to the idiomatic way to achieve this in Makie?
Any code snippets or examples would be very helpful. Thank you!
If you’re not actually using the left axis for numeric ticks, just flip the y axis to the right side and use a Label(fig[i, j, Left()], rotation = pi/2, ...) for the “Intensity” label.
If you do need a secondary axis, you can currently only achieve that by placing an Axis on top, hiding everything you don’t need and linking the non-twin axis in case you want to plot anything there that needs to be in sync.
I understand. I think there are quite a few situations where a second axis is needed—such as plotting spectrum with energy on the bottom axis and wavelength on the top axis, or plotting reaction rate as a function of the temperature T on the top axis and 1/T on the bottom axis. Thus,I had assumed that Makie would already support this. However, it seems this feature hasn’t been implemented in Makie yet. Is this possible in Plots?
Makie does support it, just like I described above, it’s just not wrapped into another convenience API. If we added one, it would do exactly that I think. If you do this often, you could wrap the couple commands needed into your own function, or think about opening a PR in Makie. I’m not sure if Plots has a keyword for this, probably.