AlgebraOfGraphics.jl
AlgebraOfGraphics.jl copied to clipboard
facets: make linked axes dependent upon the direction keyword
visual(BarPlot, direction=:x)
links the x-axes as usual, which is wrong in this case.
As I just saw, it looks like AoG cannot handle the direction keyword at all since the axes are named as if the axes weren't flipped
Yes, it's waiting for https://github.com/JuliaPlots/Makie.jl/issues/926 to handle it without too many contorsions, but it's good to keep in mind that axes linking should also take this into account.
until then, is there any easy way to flip the plot direction aside of manually drawing it with Makie directly?
You can probably hack your way around it with something like
@recipe(FlippedBarPlot) do scene
return default_theme(scene, BarPlot)
end
Makie.convert_arguments(::Type{<:FlippedBarPlot}, x, y) = PlotSpec{BarPlot}(y, x, direction=:x)
plt = data((x=rand(3), y=["a", "b","c"])) * mapping(:x, :y) * visual(FlippedBarPlot)
where the association variable -> axis is preserved in the recipe FlippedBarPlot
, so everything should work
You can probably hack your way around it with something like
I also just encountered this issue and tried out the hack, but it seems it doesn't actualy use the x values but instead just integers 1:length(y). I'm not that familiar with the Makie recipe system, is that just due to a typo or something more involved?
Ah just saw the other issue, sorry for the noise. Feel free to ignore!