bar_width and bar_edges keywords; small fixes

This commit is contained in:
Thomas Breloff 2016-05-19 17:34:37 -04:00
parent 3cea2df459
commit fb60c244f6
3 changed files with 8 additions and 5 deletions

View File

@ -146,6 +146,8 @@ _series_defaults[:marker_z] = nothing # value for color scale
_series_defaults[:levels] = 15
_series_defaults[:orientation] = :vertical
_series_defaults[:bar_position] = :overlay # for bar plots and histograms: could also be stack (stack up) or dodge (side by side)
_series_defaults[:bar_width] = 0.8
_series_defaults[:bar_edges] = false
_series_defaults[:xerror] = nothing
_series_defaults[:yerror] = nothing
_series_defaults[:ribbon] = nothing
@ -957,7 +959,7 @@ function _update_subplot_args(plt::Plot, sp::Subplot, d_in::KW, subplot_index::I
else
spargs[axissym] = Axis(letter)
end
# grab magic args (for example `xaxis = (:flip, :log)`)
args = wraptuple(get(d_in, axissym, ()))

View File

@ -16,7 +16,7 @@ supportedArgs(::PyPlotBackend) = [
:markershape, :markercolor, :markersize, :markeralpha,
:markerstrokewidth, :markerstrokecolor, :markerstrokealpha,
:fillrange, :fillcolor, :fillalpha,
:bins,
:bins, :bar_width, :bar_edges,
:n, :nc, :nr, :layout,
:smooth,
:title, :windowtitle, :show, :size,
@ -94,6 +94,7 @@ end
getPyPlotColor(c::Colorant, α=nothing) = map(f->float(f(convertColor(c,α))), (red, green, blue, alpha))
getPyPlotColor(cvec::ColorVector, α=nothing) = map(getPyPlotColor, convertColor(cvec, α).v)
getPyPlotColor(scheme::ColorScheme, α=nothing) = getPyPlotColor(convertColor(getColor(scheme), α))
getPyPlotColor(vec::AVec, α=nothing) = map(c->getPyPlotColor(c,α), vec)
getPyPlotColor(c, α=nothing) = getPyPlotColor(convertColor(c, α))
function getPyPlotColorMap(c::ColorGradient, α=nothing)
@ -662,14 +663,14 @@ function _add_series(plt::Plot{PyPlotBackend}, series::Series)
end
if st == :bar
extrakw[isvertical(d) ? :width : :height] = 0.9
extrakw[isvertical(d) ? :width : :height] = d[:bar_width]
handle = ax[isvertical(d) ? :bar : :barh](x, y;
label = d[:label],
zorder = plt.n,
color = pyfillcolor(d),
edgecolor = pylinecolor(d),
linewidth = d[:linewidth],
align = "center",
align = d[:bar_edges] ? "edge" : "center",
extrakw...
)[1]
push!(handles, handle)

View File

@ -179,6 +179,7 @@ function _apply_series_recipe(plt::Plot, d::KW)
end
# add the series!
warnOnUnsupportedArgs(plt.backend, d)
warnOnUnsupported(plt.backend, d)
series = Series(d)
push!(plt.series_list, series)
@ -269,7 +270,6 @@ function _plot!(plt::Plot, d::KW, args...)
end
# check that the backend will support the command and add it to the list
warnOnUnsupportedArgs(plt.backend, kw)
warnOnUnsupportedScales(plt.backend, kw)
push!(kw_list, kw)