diff --git a/src/recipes.jl b/src/recipes.jl index 331c5100..91bd721b 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -122,8 +122,8 @@ end @deps hline straightline @recipe function f(::Type{Val{:vline}}, x, y, z) - n = length(y) - newx = vec(Float64[yi for i = 1:3, yi in y]) + n = length(x) + newx = vec(Float64[xi for i = 1:3, xi in x]) newy = repeat(Float64[1, 2, NaN], n) x := newx y := newy @@ -765,7 +765,7 @@ end @recipe function f(::Type{Val{:barhist}}, x, y, z) h = _make_hist( - (y,), + (x,), plotattributes[:bins], normed = plotattributes[:normalize], weights = plotattributes[:weights], @@ -779,7 +779,7 @@ end @recipe function f(::Type{Val{:stephist}}, x, y, z) h = _make_hist( - (y,), + (x,), plotattributes[:bins], normed = plotattributes[:normalize], weights = plotattributes[:weights], diff --git a/src/shorthands.jl b/src/shorthands.jl index 7b9584c9..0311e5d3 100644 --- a/src/shorthands.jl +++ b/src/shorthands.jl @@ -58,6 +58,9 @@ julia> histogram([1,2,1,1,4,3,8],bins=0:8) ``` """ @shorthands histogram +histogram(x; kw...) = plot(x, []; kw..., seriestype=:histogram) +histogram!(x; kw...) = plot!(x, []; kw..., seriestype=:histogram) +histogram!(plt, x; kw...) = plot!(plt, x, []; kw..., seriestype=:histogram) """ barhist(x) @@ -66,15 +69,21 @@ julia> histogram([1,2,1,1,4,3,8],bins=0:8) Make a histogram bar plot. See `histogram`. """ @shorthands barhist +barhist(x; kw...) = plot(x, []; kw..., seriestype=:barhist) +barhist!(x; kw...) = plot!(x, []; kw..., seriestype=:barhist) +barhist!(plt, x; kw...) = plot!(plt, x, []; kw..., seriestype=:barhist) """ stephist(x) - stephist(x) + stephist!(x) Make a histogram step plot (bin counts are represented using horizontal lines instead of bars). See `histogram`. """ @shorthands stephist +stephist(x; kw...) = plot(x, []; kw..., seriestype=:stephist) +stephist!(x; kw...) = plot!(x, []; kw..., seriestype=:stephist) +stephist!(plt, x; kw...) = plot!(plt, x, []; kw..., seriestype=:stephist) """ scatterhist(x) @@ -190,6 +199,9 @@ julia> vline([-1,0,2]) ``` """ @shorthands vline +vline(x; kw...) = plot(x, []; kw..., seriestype=:vline) +vline!(x; kw...) = plot!(x, []; kw..., seriestype=:vline) +vline!(plt, x; kw...) = plot!(plt, x, []; kw..., seriestype=:vline) """ hspan(y)