Fix vline, histogram, barhist, stephist axis letter

This commit is contained in:
Benoit Pasquier 2020-07-16 12:56:42 +10:00 committed by Simon Christ
parent 0425f656ae
commit d827fa434c
2 changed files with 17 additions and 5 deletions

View File

@ -122,8 +122,8 @@ end
@deps hline straightline @deps hline straightline
@recipe function f(::Type{Val{:vline}}, x, y, z) @recipe function f(::Type{Val{:vline}}, x, y, z)
n = length(y) n = length(x)
newx = vec(Float64[yi for i = 1:3, yi in y]) newx = vec(Float64[xi for i = 1:3, xi in x])
newy = repeat(Float64[1, 2, NaN], n) newy = repeat(Float64[1, 2, NaN], n)
x := newx x := newx
y := newy y := newy
@ -765,7 +765,7 @@ end
@recipe function f(::Type{Val{:barhist}}, x, y, z) @recipe function f(::Type{Val{:barhist}}, x, y, z)
h = _make_hist( h = _make_hist(
(y,), (x,),
plotattributes[:bins], plotattributes[:bins],
normed = plotattributes[:normalize], normed = plotattributes[:normalize],
weights = plotattributes[:weights], weights = plotattributes[:weights],
@ -779,7 +779,7 @@ end
@recipe function f(::Type{Val{:stephist}}, x, y, z) @recipe function f(::Type{Val{:stephist}}, x, y, z)
h = _make_hist( h = _make_hist(
(y,), (x,),
plotattributes[:bins], plotattributes[:bins],
normed = plotattributes[:normalize], normed = plotattributes[:normalize],
weights = plotattributes[:weights], weights = plotattributes[:weights],

View File

@ -58,6 +58,9 @@ julia> histogram([1,2,1,1,4,3,8],bins=0:8)
``` ```
""" """
@shorthands histogram @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) 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`. Make a histogram bar plot. See `histogram`.
""" """
@shorthands barhist @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) stephist!(x)
Make a histogram step plot (bin counts are represented using horizontal lines Make a histogram step plot (bin counts are represented using horizontal lines
instead of bars). See `histogram`. instead of bars). See `histogram`.
""" """
@shorthands stephist @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) scatterhist(x)
@ -190,6 +199,9 @@ julia> vline([-1,0,2])
``` ```
""" """
@shorthands vline @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) hspan(y)