JuliaPlots / StatsPlots.jl

Statistical plotting recipes for Plots.jl
Other
437 stars 88 forks source link

Add support for horizontal violin and dot plots #492

Closed churli closed 2 years ago

churli commented 2 years ago

The horizontal::Bool kwarg has been added to the violin and dotplot recipes and this allows generating horizontal versions of these plots.

churli commented 2 years ago

For context: I needed to have horizontal violin e boxplots and found it easy to tweak the StatsPlots library to get them, now I'm sharing this back with you. Cheers!

BeastyBlacksmith commented 2 years ago

That looks good already, it would be good to use the existing attribute orientation though. Maybe you can compare to the recipe for boxplots ( that got this in https://github.com/JuliaPlots/StatsPlots.jl/commit/be7f9c03110242707915aaaae8e1e316b179a3d5).

churli commented 2 years ago

Thanks a lot for the suggestion, my bad that I didn't check how it was implemented for boxplots. Now it works through the orientation attribute for violins and dotplots as well.

BeastyBlacksmith commented 2 years ago

It doesn't account for the tick labels though. Here is a MWE

using StatsPlots
import RDatasets
singers = RDatasets.dataset("lattice", "singer")
@df singers violin(:VoicePart, :Height, line = 0, fill = (0.2, :blue), orientation = :horizontal)

violins