With the following code, the y-axis is based on the distribution and adding the vertical line does not change that.
using Distributions, StatPlots
gr()
dist = Normal(1,1)
p = plot(dist, fill=(0,0.5))
plot!(p, [mean(dist)], linetype=:vline, label="")
I would like to achieve the same behavior within a Plots Recipe but if I add a vertical line as a new series then it changes the y-axis range.
struct SomeWrapper{T<:Distributions.Distribution}
dist::T
end
using RecipesBase
@recipe function f(foo::SomeWrapper)
@series begin
fill --> (0, 0.5)
foo.dist
end
@series begin
linetype --> :vline
label --> ""
[mean(foo.dist)]
end
end
plot(SomeWrapper(Normal(1,1)))
How can I fix that (i.e., force the ylims to be based only on the first series)?