Closed sethaxen closed 3 years ago
I think it would be easier (and probably faster) to not use detault_range
but
min_dist, max_dist = extrema(dist)
(that will always work)support
if both are bounded (this should also work, the bug in Distributions only affects unbounded support)Maybe it would be a good opportunity to address #287 as well.
Done!
julia> plot(Binomial(50, 0.5))
I made the same work for discrete mixtures. e.g. here is zero-inflated Poisson:
julia> zip = MixtureModel([Dirac(0), Poisson(10)], [0.1, 0.9])
MixtureModel{Distribution{Univariate, Discrete}}(K = 2)
components[1] (prior = 0.1000): Dirac{Int64}(value=0)
components[2] (prior = 0.9000): Poisson{Float64}(λ=10.0)
julia> plot(zip)
julia> plot(zip; components=false)
I wonder if one has to include markers for
:sticks
by default?
Can you clarify what you mean?
If it is necessary to set markershape
or if one should just not plot markers with the default settings.
If it is necessary to set
markershape
or if one should just not plot markers with the default settings.
Setting markershape
is necessary to show the markers as suggested in the original issue. Personally, I prefer hair plots without markers and would prefer the simplicity of not explicitly showing them and letting the user do it if they want it. What do you think?
Personally, I prefer hair plots without markers and would prefer the simplicity of not explicitly showing them and letting the user do it if they want it.
Yes, my question was if you think it would be preferrable to not show them explicitly. I prefer the version without markers (IMO it is a bit cleaner, in particular if there are many values to plot) and it seems simple enough to specify markershape
if one wants to plot points as well.
Okay, I simplified the implementation to not show markers by default.
julia> plot(Binomial(50, 0.5))
For plots with few points, in my view this looks worse:
julia> plot(plot(Binomial(5, 0.1)), plot(Binomial(5, 0.1); markershape=:circle))
But it looks much better for plots with many points:
julia> plot(plot(Poisson(500)), plot(Poisson(500); markershape=:circle); legend=:left)
This PR fixes #450 and fixes #287.