Skip to content

Commit

Permalink
support string labels in bar (work around matplotlib/matplotlib#2516)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Jan 4, 2014
1 parent ec2a991 commit 3217abe
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/PyPlot.jl
Expand Up @@ -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.

Expand Down

0 comments on commit 3217abe

Please sign in to comment.