Skip to content

Commit

Permalink
Merge pull request #376 from JuliaPlots/mkb/dist-fix
Browse files Browse the repository at this point in the history
use Int for range in discrete distributions; close #308
  • Loading branch information
mkborregaard authored Sep 7, 2020
2 parents 244355c + 7992613 commit 224277f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/distributions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function default_range(m::Distributions.MixtureModel, alpha = 0.0001)
end

yz_args(dist) = default_range(dist)
yz_args(dist::Distribution{N, T}) where N where T<:Discrete = (UnitRange(default_range(dist)...),)
yz_args(dist::Distribution{N, T}) where N where T<:Discrete = (UnitRange(Int.(default_range(dist))...),)

# this "user recipe" adds a default x vector based on the distribution's μ and σ
@recipe function f(dist::Distribution)
Expand Down

1 comment on commit 224277f

@mkborregaard
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For anyone watching, I was very in doubt whether to go Int.(default_range(dist)) here or promote(default_range(dist)...). I opted for the first because I'm pretty sure Integer should always be correct.

Please sign in to comment.