# How to make Makie plot react to two observales?

**URL:** <https://discourse.julialang.org/t/how-to-make-makie-plot-react-to-two-observales/94644>\
**Category:** New to Julia\
**Tags:** question, plotting, makie, observables\
**Created:** [February 14, 2023, 8:15pm UTC](https://discourse.julialang.org/t/how-to-make-makie-plot-react-to-two-observales/94644 "2023-02-14T20:15:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AwesomeQuest](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/awesomequest/32/38910_2.png) [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Post date:** [February 14, 2023, 8:15pm UTC](https://discourse.julialang.org/t/how-to-make-makie-plot-react-to-two-observales/94644/1 "2023-02-14T20:15:52Z")

</div>

How can I make a Makie plot that is dependent on two observables, one variable dependent no the other, react when I change the master variable?

For Instance

```julia
using GLMakie, Makie

x = -10.0:.1:10.0
y = Observable(x .^2)

fig, ax, l = lines(x,y)
y[] = (rand()+1) .*y[]

```

Updates when I run the last line.  
But

```julia
using GLMakie, Makie

x = Observable(-10.0:.1:10.0)
y = @lift($x .^ 2)

fig, ax, l = lines(x,y)
x[] = -10.0:.1:11.0

```

Doesn’t update even though `y` has updated?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [February 14, 2023, 8:25pm UTC](https://discourse.julialang.org/t/how-to-make-makie-plot-react-to-two-observales/94644/2 "2023-02-14T20:25:52Z")

</div>

The reason is that x is longer than y after the update, this is described here [https://docs.makie.org/stable/documentation/nodes/#problems\_with\_synchronous\_updates](https://docs.makie.org/stable/documentation/nodes/#problems_with_synchronous_updates)

It’s better to make one `Observable{Vector{Point2f}}` for example, so you can update both x and y components at once.
