# Makie - reliably updating plots from another thread

**URL:** https://discourse.julialang.org/t/makie-reliably-updating-plots-from-another-thread/109905
**Category:** General Usage
**Created:** [February 8, 2024, 2:53am UTC](https://discourse.julialang.org/t/makie-reliably-updating-plots-from-another-thread/109905 "2024-02-08T02:53:05Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bryaan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bryaan/32/36858_2.png) [@bryaan](https://discourse.julialang.org/u/bryaan)
#### Post date: [February 8, 2024, 2:53am UTC](https://discourse.julialang.org/t/makie-reliably-updating-plots-from-another-thread/109905/1 "2024-02-08T02:53:05Z")

</div>

Why does the following code not reliably update the plot and sometimes fail with a bounds access error?

```julia
using GLMakie

fig = Figure()

# Heatmap 
cm = rand(500, 500)
const obc = Observable(cm)

ax = Axis(fig[3, 1])
heatmap!(ax, obc, colormap=:thermal)

# Line plot
x = range(0, 100, length=100000)
y = sin.(x)
plot_series = Observable(Point2f.(x, y))

ax = Axis(fig[2, :])
lines!(ax, plot_series)

tm = Timer((timer) -> begin
        notify(obc)
        notify(plot_series)
    end, 0.0, interval=1 / 10)

i = 101
Threads.@spawn while true
    cm .= rand(500, 500)
    push!(plot_series[], Point2f(i, sin(i)))
    global i += 1
    sleep(0.2)
end

```
