The code produces this plot, which you can see the y-axes of two plots are aligned but not in the way that I expected. The first plot is compressed in order to match with the y-axis of the second one.
That’s exactly what linkyaxes!(axis, axis2) does, it gives both axes the same y-range. One is just much larger than the other in your example. What is the behavior you would like instead?
Hi, thanks for your replying. Maybe I’m using the wrong functionality. What I want to see is two plots are drawn on the same grid with, for example, 5 ticks each on the y-axis that’re aligned with each other. I tried to set the number of ticks as well as ticks displayed manually but the result is far from what I want. Do you have any idea how to handle case like this ?
Can you show a visual example from some other plot that looks like what you’re after? I’m a bit confused because you have two distributions with very different ranges, so either each has its own y axis range, and they won’t have equal ticks, or you link the axes and achieve the result from above.
Hi, below is the example that I’m trying to recreate in Makie. Please note that in the picture both plots are drawn in a same grid which are aligned with each other, despite as you said they came from a different distributions. Also, the ticks are well scattered across the y-axis as well, which is not the case in my plot. I’m not sure whether it’s even possible to create something like that or not.
The ticks are not spaced well because your plots are much wider than the domain you’re sampling from. That’s because the kernel density extends farther than the extrema of the data. But you can set datalimits for that on the violin! call.
Other than that there’s nothing “linked” about this plot, it’s just manually chosen to look nice I assume.
Here’s with datalimits = extrema. Much better but you might want to control the limits exactly if you want a perfect match, right now the extrema are a little bit random given the input data.