# EnsembleProblem and plotly

**URL:** <https://discourse.julialang.org/t/ensembleproblem-and-plotly/40742>\
**Category:** New to Julia\
**Created:** [June 4, 2020, 4:05pm UTC](https://discourse.julialang.org/t/ensembleproblem-and-plotly/40742 "2020-06-04T16:05:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [June 4, 2020, 4:05pm UTC](https://discourse.julialang.org/t/ensembleproblem-and-plotly/40742/1 "2020-06-04T16:05:33Z")

</div>

One problem solve, next problem.

I am learning to use EnsembleProblem together with Jump Processes. The code:

```julia
jprob, prob = setupSystem(dgr)
@time sol = solve(jprob, SSAStepper(), saveat=0.25)

ensemble_prob = EnsembleProblem(jprob)
sim = solve(ensemble_prob, SSAStepper(), trajectories=1)
plotly()
plot(sim, linealpha=0.4)

```

freezes when executing the `plot` command. What is worse, is that when I interrupt, the `plot` command, I do not return to the Julia client, but I am forced to restart Julia.

Here is the output to `sim`:

```julia
julia> sim
EnsembleSolution Solution of length 1 with uType:
ODESolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Nothing,DiscreteProblem{Array{Float64,1},Tuple{Float64,Float64},true,Array{Float64,1},DiscreteFunction{true,ModelingToolkit.var"#103#104",Nothing,Array{Symbol,1}},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}},SSAStepper,DiffEqBase.ConstantInterpolation{Array{Float64,1},Array{Array{Float64,1},1}},Nothing}

```

I must say that I love Julia, but so far, everything is a struggle. I wish the learning curve was not so steep!

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [June 4, 2020, 4:51pm UTC](https://discourse.julialang.org/t/ensembleproblem-and-plotly/40742/2 "2020-06-04T16:51:35Z")

</div>

Sounds like that’s a Plots.jl plotly issue with ribbons? Worth a Plots.jl issue.

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [June 4, 2020, 5:07pm UTC](https://discourse.julialang.org/t/ensembleproblem-and-plotly/40742/3 "2020-06-04T17:07:46Z")

</div>

What do you mean by ribbons? How to construct a MWE if I do not know the cause?

I was copying your example applied to JumProblem. I will see if I can simplify this.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [June 4, 2020, 5:09pm UTC](https://discourse.julialang.org/t/ensembleproblem-and-plotly/40742/4 "2020-06-04T17:09:41Z")

</div>

Oh actually you’re not using ribbons. Maybe Plotly is just having problems for you?

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [June 4, 2020, 5:18pm UTC](https://discourse.julialang.org/t/ensembleproblem-and-plotly/40742/5 "2020-06-04T17:18:44Z")

</div>

I changed the number of graph nodes from 300 to 30, and plotly worked, but is slow. The gr() backend is substantially faster, but not fast on a 300 node graph. And that is only with a single trajectory!

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [June 4, 2020, 5:19pm UTC](https://discourse.julialang.org/t/ensembleproblem-and-plotly/40742/6 "2020-06-04T17:19:47Z")

</div>

Plotly is fairly slow in comparison to GR. It’s just a limitation of the fact that it’s interactive javascript.

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [June 4, 2020, 5:28pm UTC](https://discourse.julialang.org/t/ensembleproblem-and-plotly/40742/7 "2020-06-04T17:28:23Z")

</div>

Yes, got it.

Now how about this?  
After generating `sim`, I typed: (notice the two `using` statements, and `get_timepoint` probably exists in both:

```julia
using DifferentialEquations.EnsembleAnalysis
using DiffEqBase.EnsembleAnalysis
a = get_timepoint(sim, 2.)
v = componentwise_vectors_timepoint(sim, 2.)

```

Now, observe the sequence of commands and responses within REPL and the four bold lines. How is it possible that typing the name of a function twice in a row will give different results?

```julia
julia> get_timepoint
get_timepoint (generic function with 1 method)

julia> get_timepoint
get_timepoint (generic function with 1 method)

**julia> componentwise_vectors_timepoint**
**get_timepoint (generic function with 1 method)**

**julia> componentwise_vectors_timepoint**
**componentwise_vectors_timepoint (generic function with 1 method)**

```
