UncertaintyQuantification.jl
UncertaintyQuantification.jl copied to clipboard
Adds basic plots
This PR adds the ability plot the following using plot recipes:
- Distributions (both pdf and cdf)
- IntervalVariables
- P-boxes
- A vector of UQInputs (plots it in a grid)
- A vector of Intervals (the ecdf of a p-box)
- A bivariate scatter of Intervals (ecdf of a bivariate p-box)
With plot recipes, various properties of the plots should be editable by the user as they would any standard plot with Plots.jl (i.e. color=:red, will make the plot red)
Eg, the following DEMO script (in demo/plotting):
using UncertaintyQuantification, Plots
X1 = RandomVariable(ProbabilityBox{Normal}(Dict(:μ => Interval(-1, 2), :σ => 1)), :X1)
X2 = RandomVariable(ProbabilityBox{Normal}(Dict(:μ => Interval(-1, 2), :σ => 2)), :X2)
X3 = IntervalVariable(-1, 2, :s)
h = RandomVariable(Normal(0.24, 0.01), :h) # height
plot(X1) # p-box
plot(X1, color = "red") # red p-box
plot(X3) # Interval
plot(h) # distribution
inputs = [X1, X2, X3, h]
plot(inputs) # Everything together
samples = sample(inputs, 50)
plot(X1)
plot!(samples.X1) # Interval ecdf of X1
plot(samples.X1[1], samples.X2[1]) # Plots 2D box
plot(samples.X1, samples.X2) # Plots bivariate random sets of X1 and X2
Codecov Report
:x: Patch coverage is 95.06173% with 8 lines in your changes missing coverage. Please review.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/plotting/plot_recipes.jl | 94.93% | 8 Missing :warning: |
:loudspeaker: Thoughts on this report? Let us know!