# Asynchronous Makie

**URL:** https://discourse.julialang.org/t/asynchronous-makie/27127
**Category:** Performance
**Tags:** plotting
**Created:** [August 3, 2019, 11:18am UTC](https://discourse.julialang.org/t/asynchronous-makie/27127 "2019-08-03T11:18:51Z")
**Posts on this page:** 1
**Showing post:** 16

<div class="post-metadata">

### Author: ![LaurentPlagne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laurentplagne/32/10103_2.png) [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)
#### Post date: [December 31, 2019, 9:52am UTC](https://discourse.julialang.org/t/asynchronous-makie/27127/16 "2019-12-31T09:52:40Z")

</div>

For @tyfdzt: here are the basic components extracted from my code with Makie streamplots.  
Note that it is not a MWE. I hope it can help you. If not I can try to write a MWE.

```julia
#The Cartesian axis :
x = range(0,stop=lx,length=nx+1); hx = lx/nx;
y = range(0,stop=ly,length=ny+1); hy = ly/ny;
#Arrays for x and y velocity arrays that evolve via CFD simulation
Ue=zeros(nx+2,ny+2)
Ve=zeros(nx+2,ny+2)
.....
#Declare a Makie Node (once) for storing velocity arrays
uvn=Node([rand(size(Ue)...),rand(size(Ve)...)])
.....
#Update the velocity uvn Node for each video frames
# Note that this is not done for each time steps but only for each video frames
push!(uvn,copy!(to_value(uvn),[Ue,Ve]))
.....
#Helper function : the Makie streamplot! function take a function 
# for its first argument (not an array)
function make_velocity(uv)
     f_vx=interpolate(uv[1],BSpline(Quadratic(Reflect(OnCell()))))
     f_vy=interpolate(uv[2],BSpline(Quadratic(Reflect(OnCell()))))
  function velocity(x,y)
     nx,ny=size(uv[1])
     xi=1+x*(nx-1)
     yi=1+y*(ny-1)
     Point2f0(f_vx(xi,yi),f_vy(xi,yi))
  end
  return velocity
end

# The call to the Makie streamplot! function : 
# this function is called each time the uvn Node is updated 
streamplot!(scene,lift(a->make_velocity(to_value(a)),uvn),
       x,y, colormap = :magma, arrow_size=0.02, gridsize=(20,20))

```

Let me know if this helps.

---

_[View the full topic](https://discourse.julialang.org/t/asynchronous-makie/27127)._
