diff --git a/src/PyPlot.jl b/src/PyPlot.jl index 0b9876f7..5b039075 100755 --- a/src/PyPlot.jl +++ b/src/PyPlot.jl @@ -246,6 +246,22 @@ fill(x::AbstractArray,y::AbstractArray, args...; kws...) = include("colormaps.jl") +########################################################################### +# Support array of string labels in bar chart + +function bar{T<:String}(x::AbstractVector{T}, y; kws...) + xi = 1:length(x) + if !any(kw -> kw[1] == :align, kws) + push!(kws, (:align, "center")) + end + p = bar(xi, y; kws...) + ax = any(kw -> kw[1] == :orientation && lowercase(kw[2]) == "horizontal", + kws) ? gca()["yaxis"] : gca()["xaxis"] + ax[:set_ticks](xi) + ax[:set_ticklabels](x) + return p +end + ########################################################################### # Include mplot3d for 3d plotting.