Fix histograms with @one_arg_shorthands + fix vspan
This commit is contained in:
parent
a2c0473244
commit
5cb7a8efb7
@ -145,7 +145,7 @@ end
|
|||||||
@recipe function f(::Type{Val{:vspan}}, x, y, z)
|
@recipe function f(::Type{Val{:vspan}}, x, y, z)
|
||||||
n = div(length(x), 2)
|
n = div(length(x), 2)
|
||||||
newx = vcat([[x[2i - 1], x[2i - 1], x[2i], x[2i], NaN] for i = 1:n]...)
|
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
|
linewidth --> 0
|
||||||
x := newx
|
x := newx
|
||||||
y := newy
|
y := newy
|
||||||
@ -763,7 +763,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(
|
||||||
(x,),
|
tuple(plotattributes[:orientation] == :horizontal ? y : x),
|
||||||
plotattributes[:bins],
|
plotattributes[:bins],
|
||||||
normed = plotattributes[:normalize],
|
normed = plotattributes[:normalize],
|
||||||
weights = plotattributes[:weights],
|
weights = plotattributes[:weights],
|
||||||
@ -777,7 +777,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(
|
||||||
(x,),
|
tuple(plotattributes[:orientation] == :horizontal ? y : x),
|
||||||
plotattributes[:bins],
|
plotattributes[:bins],
|
||||||
normed = plotattributes[:normalize],
|
normed = plotattributes[:normalize],
|
||||||
weights = plotattributes[:weights],
|
weights = plotattributes[:weights],
|
||||||
@ -791,7 +791,7 @@ end
|
|||||||
|
|
||||||
@recipe function f(::Type{Val{:scatterhist}}, x, y, z)
|
@recipe function f(::Type{Val{:scatterhist}}, x, y, z)
|
||||||
h = _make_hist(
|
h = _make_hist(
|
||||||
(y,),
|
tuple(plotattributes[:orientation] == :horizontal ? y : x),
|
||||||
plotattributes[:bins],
|
plotattributes[:bins],
|
||||||
normed = plotattributes[:normalize],
|
normed = plotattributes[:normalize],
|
||||||
weights = plotattributes[:weights],
|
weights = plotattributes[:weights],
|
||||||
|
|||||||
@ -57,10 +57,7 @@ Plot a histogram.
|
|||||||
julia> histogram([1,2,1,1,4,3,8],bins=0:8)
|
julia> histogram([1,2,1,1,4,3,8],bins=0:8)
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
@shorthands histogram
|
@one_arg_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)
|
||||||
@ -68,10 +65,7 @@ histogram!(plt, x; kw...) = plot!(plt, x, []; kw..., seriestype=:histogram)
|
|||||||
|
|
||||||
Make a histogram bar plot. See `histogram`.
|
Make a histogram bar plot. See `histogram`.
|
||||||
"""
|
"""
|
||||||
@shorthands barhist
|
@one_arg_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)
|
||||||
@ -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
|
Make a histogram step plot (bin counts are represented using horizontal lines
|
||||||
instead of bars). See `histogram`.
|
instead of bars). See `histogram`.
|
||||||
"""
|
"""
|
||||||
@shorthands stephist
|
@one_arg_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)
|
||||||
@ -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
|
Make a histogram scatter plot (bin counts are represented using points
|
||||||
instead of bars). See `histogram`.
|
instead of bars). See `histogram`.
|
||||||
"""
|
"""
|
||||||
@shorthands scatterhist
|
@one_arg_shorthands scatterhist
|
||||||
|
|
||||||
"""
|
"""
|
||||||
histogram2d(x,y)
|
histogram2d(x,y)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user