Reputation: 112
I am trying to create Violin Plots using the StatsPlots.jl library. However, I would like to have the returned Violin plot to be horizontal instead of vertical as I want to show the distribution of a variable (e.g. Temperature) for different heights, eg. at 1000m, 2000m, 3000m ...
So it would be nice if the height was at the y-Axis while the temperature distribution was on the x-Axis. Is there a way to swap the axes of a Plots.Plot struct, or is there an argument I could pass to violin() that does the trick?
Upvotes: 2
Views: 236
Reputation: 26
It seems the permute
keyword is documented for other plots (see Plots API) and it works for me with violin
(StatsPlots v0.15.7). Here's the syntax:
violin(
repeat([1,2,3], outer=100),
randn(300),
permute = (:y, :x)
)
Upvotes: 1