working on pyplot refactor; barh added
This commit is contained in:
parent
d4ccf0ec62
commit
50fa013801
@ -34,6 +34,8 @@ export
|
||||
scatter!,
|
||||
bar,
|
||||
bar!,
|
||||
barh,
|
||||
barh!,
|
||||
histogram,
|
||||
histogram!,
|
||||
histogram2d,
|
||||
@ -163,6 +165,8 @@ scatter(args...; kw...) = plot(args...; kw..., linetype = :scatter)
|
||||
scatter!(args...; kw...) = plot!(args...; kw..., linetype = :scatter)
|
||||
bar(args...; kw...) = plot(args...; kw..., linetype = :bar)
|
||||
bar!(args...; kw...) = plot!(args...; kw..., linetype = :bar)
|
||||
barh(args...; kw...) = plot(args...; kw..., linetype = :barh, orientation = :h)
|
||||
barh!(args...; kw...) = plot!(args...; kw..., linetype = :barh, orientation = :h)
|
||||
histogram(args...; kw...) = plot(args...; kw..., linetype = :hist)
|
||||
histogram!(args...; kw...) = plot!(args...; kw..., linetype = :hist)
|
||||
histogram2d(args...; kw...) = plot(args...; kw..., linetype = :hist2d)
|
||||
|
||||
@ -458,20 +458,15 @@ function _add_series(pkg::PyPlotBackend, plt::Plot, d::KW)
|
||||
|
||||
# bars
|
||||
if lt in (:bar, :sticks)
|
||||
barx, bary = if isvertical(d)
|
||||
x, y
|
||||
else
|
||||
y, x
|
||||
end
|
||||
handle = ax[:bar](barx, bary;
|
||||
extrakw[isvertical(d) ? :width : :height] = (lt == :sticks ? 0.1 : 0.9)
|
||||
handle = ax[isvertical(d) ? :bar : :barh](x, y;
|
||||
label = d[:label],
|
||||
zorder = plt.n + 0.5,
|
||||
width = (lt == :sticks ? 0.1 : 0.9),
|
||||
color = pyfillcolor(d),
|
||||
edgecolor = pylinecolor(d),
|
||||
linewidth = d[:linewidth],
|
||||
align = "center",
|
||||
orientation = (isvertical(d) ? "vertical" : "horizontal")
|
||||
extrakw...
|
||||
)[1]
|
||||
push!(handles, handle)
|
||||
end
|
||||
@ -483,7 +478,7 @@ function _add_series(pkg::PyPlotBackend, plt::Plot, d::KW)
|
||||
|
||||
# add the colorbar legend
|
||||
if plt.plotargs[:colorbar] != :none && haskey(extrakw, :cmap)
|
||||
PyPlot.colorbar(handles[1], ax=ax)
|
||||
PyPlot.colorbar(handles[end], ax=ax)
|
||||
end
|
||||
|
||||
# this sets the bg color inside the grid
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user