diff --git a/src/recipes.jl b/src/recipes.jl index 3b1703b8..468acf0d 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -145,7 +145,7 @@ end @recipe function f(::Type{Val{:vspan}}, x, y, z) n = div(length(x), 2) newx = vcat([[x[2i - 1], x[2i - 1], x[2i], x[2i], NaN] for i = 1:n]...) - newy = repeat([-Inf, Inf, Inf, -Inf, NaN], outer=div(length(x),2)) + newy = repeat([-Inf, Inf, Inf, -Inf, NaN], outer = n) linewidth --> 0 x := newx y := newy @@ -763,7 +763,7 @@ end @recipe function f(::Type{Val{:barhist}}, x, y, z) h = _make_hist( - (x,), + tuple(plotattributes[:orientation] == :horizontal ? y : x), plotattributes[:bins], normed = plotattributes[:normalize], weights = plotattributes[:weights], @@ -777,7 +777,7 @@ end @recipe function f(::Type{Val{:stephist}}, x, y, z) h = _make_hist( - (x,), + tuple(plotattributes[:orientation] == :horizontal ? y : x), plotattributes[:bins], normed = plotattributes[:normalize], weights = plotattributes[:weights], @@ -791,7 +791,7 @@ end @recipe function f(::Type{Val{:scatterhist}}, x, y, z) h = _make_hist( - (y,), + tuple(plotattributes[:orientation] == :horizontal ? y : x), plotattributes[:bins], normed = plotattributes[:normalize], weights = plotattributes[:weights], diff --git a/src/shorthands.jl b/src/shorthands.jl index 1417cc7d..59275610 100644 --- a/src/shorthands.jl +++ b/src/shorthands.jl @@ -57,10 +57,7 @@ Plot a histogram. 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) +@one_arg_shorthands histogram """ barhist(x) @@ -68,10 +65,7 @@ histogram!(plt, x; kw...) = plot!(plt, x, []; kw..., seriestype=:histogram) 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) +@one_arg_shorthands barhist """ stephist(x) @@ -80,10 +74,7 @@ barhist!(plt, x; kw...) = plot!(plt, x, []; kw..., seriestype=:barhist) 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) +@one_arg_shorthands stephist """ scatterhist(x) @@ -92,7 +83,7 @@ stephist!(plt, x; kw...) = plot!(plt, x, []; kw..., seriestype=:stephist) Make a histogram scatter plot (bin counts are represented using points instead of bars). See `histogram`. """ -@shorthands scatterhist +@one_arg_shorthands scatterhist """ histogram2d(x,y)