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