Support for CategoricalValue in StatsPlots

I had totally forgotten that I had asked a similar question over two years ago. See Ordering the y-axis values in a dotplot . Here is a workaround…

Assuming the :VoicePart is the categorical array, then you can do…

cticks(ctg::CategoricalArray) = (1:length(levels(ctg)), levels(ctg))
df singers violin(levelcode.(:VoicePart),:Height, xticks=cticks(:VoicePart), side=:right, marker=(0.2, :blue, stroke(0)), label="Scala")

A bit ugly, but it works. Basically, the x value is the integer code for the the level of that entry and then the xticks is a translation from that code to the string level description.

Would be nice if CategoricalArrays just worked for plotting. There’s an open issue about this at https://github.com/JuliaData/CategoricalArrays.jl/issues/256 .