# Using Makie with Revise

**URL:** <https://discourse.julialang.org/t/using-makie-with-revise/56195>\
**Category:** New to Julia\
**Created:** [February 28, 2021, 3:06pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195 "2021-02-28T15:06:45Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![danvenn](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@danvenn](https://discourse.julialang.org/u/danvenn)\
**Post date:** [February 28, 2021, 3:06pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/1 "2021-02-28T15:06:45Z")

</div>

Hi - is there a workflow that helps with incrementally building a graph with Makie?  
At the moment, I am having to restart the REPL when making large changes to my scene (changing a barplot to a line for example). The compile time makes it impossible to quickly iterate.

I can get revise to spot function changes as per the examples, but changing a colour variable, or adding a new Makie scene doesn’t have an effect on the graph until restarting.

Thanks!

---

<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:** [February 28, 2021, 3:38pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/2 "2021-02-28T15:38:05Z")

</div>

Do you use includet ? Is your function part of a project ?

---

<div class="post-metadata">

**Author:** ![danvenn](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@danvenn](https://discourse.julialang.org/u/danvenn)\
**Post date:** [February 28, 2021, 3:54pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/3 "2021-02-28T15:54:38Z")

</div>

Yes, using includet will update any functions. But newly declared or changed variables aren’t picked up. I have to manually redefine my scene in the REPL to get it to update ( at least that way there’s no need to recompile!)

How do you mean by the project part? I have a folder full of scripts at the moment, and I’m activating that folder as a project in pkg yes.

---

<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 28, 2021, 4:04pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/4 "2021-02-28T16:04:14Z")

</div>

You’re doing something wrong if you have to restart for changed plotting functions… I’m not sure what exactly you’re doing, but Makie is really no different from any other package in terms of running changed code with revise. And it sounds like you’re not making changes to library code, just your own right? I’m just wondering because your title is Makie specific, but your problem seems not to be Makie related

---

<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 28, 2021, 4:17pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/5 "2021-02-28T16:17:19Z")

</div>

Maybe you can give a more concrete example of your workflow, so we might find where the problem is

---

<div class="post-metadata">

**Author:** ![danvenn](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@danvenn](https://discourse.julialang.org/u/danvenn)\
**Post date:** [February 28, 2021, 4:33pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/6 "2021-02-28T16:33:09Z")

</div>

Hi Jules,

That’s right, I’m changing my own code. I chose that title in case someone had been through a similar issue with it. I wasn’t sure where the issue stems from, just my current use case. 🙂

I’ll outline what I’ve done / been doing -

- Revise, then OhMyREPL in startup.jl. I’ve also set it to activate the project in open directory automatically.
- Running Julia in VSCode, on OS X
- adapting the Makie tutorial code:

```julia
using GLMakie
col = :red
xs = Node([2,2])
ys = Node(Node[2,3])
scene2 = barplot(xs, ys, color = col)
display(scene2)

```

Adding or changing variables in my file won’t show in the REPL. If I change the array literals ‘yx’ or ‘ys’ and hit save, they don’t update their value or the graph. Same for `col`

Functions as I said will update so Revise does seem to be working. Though you’re right that the issue seems to be stemming from that rather than Makie, or I’m misunderstanding what Revise is able to spot.

There’s not much else going on in terms of workflow, only just started it.

---

<div class="post-metadata">

**Author:** ![danvenn](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@danvenn](https://discourse.julialang.org/u/danvenn)\
**Post date:** [February 28, 2021, 5:01pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/7 "2021-02-28T17:01:43Z")

</div>

I found the answer in the Revise docs . Rather confusingly, `includet()` doesn’t track variable changes by default.  
Adding ` __revise_mode__ = :eval `will enable it.  
Will test it out with Makie shortly, but that should solve it.

---

<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:** [February 28, 2021, 5:05pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/8 "2021-02-28T17:05:23Z")

</div>

You should put everything inside a function. If the function is inside a “revised” module then all change will be taken into account.  
 ![toto](https://global.discourse-cdn.com/julialang/original/3X/c/1/c11fb7cdecda249e4ac0b48ebce59b3f2624d90f.gif)

---

<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:** [February 28, 2021, 5:10pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/9 "2021-02-28T17:10:27Z")

</div>

I will prepare a video to show a standard workflow using Revise in a project.  
I did prepare this one [https://www.youtube.com/watch?v=BLcNv\_f75kI](https://www.youtube.com/watch?v=BLcNv_f75kI) but it is in french… excuse my french !

---

<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:** [February 28, 2021, 5:18pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/10 "2021-02-28T17:18:59Z")

</div>

Cool ! I was not aware of this.

---

<div class="post-metadata">

**Author:** ![danvenn](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@danvenn](https://discourse.julialang.org/u/danvenn)\
**Post date:** [February 28, 2021, 5:46pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/11 "2021-02-28T17:46:24Z")

</div>

That would be really helpful. Yes most things should be in functions anyway but for a quick throwaway test the standard behaviour is puzzling to begin with! Thanks for your help.

---

<div class="post-metadata">

**Author:** ![danvenn](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@danvenn](https://discourse.julialang.org/u/danvenn)\
**Post date:** [February 28, 2021, 7:37pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/12 "2021-02-28T19:37:28Z")

</div>

Okay so I’m still having an issue getting live updates. Revise will change the variables now.

But either directly editing the `Node([x,y]) `definitions or updating them using `node[]=[x,y]` still doesn’t show a change in the graph? Still the same problem for editing static values like `col` for example. I have to re-run the line defining the graph scene again to show the change.

Same issue happens if the code is inside a function.

Am I missing something obvious? Or is that expected behaviour?

---

<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:** [February 28, 2021, 8:40pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/13 "2021-02-28T20:40:41Z")

</div>

I am afraid I do not understand your workflow.  
Maybe a MWE could help…

---

<div class="post-metadata">

**Author:** ![danvenn](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@danvenn](https://discourse.julialang.org/u/danvenn)\
**Post date:** [February 28, 2021, 9:30pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/14 "2021-02-28T21:30:36Z")

</div>

I’m simply running a script using includet() from command line. I can soldier on and keep calling the graphing function manually for now.

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [March 1, 2021, 1:45am UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/15 "2021-03-01T01:45:45Z")

</div>

Why don’t you just re`include` the file that does the actual drawing? Put serious functions in a package and let Revise handle those, but just reexecute your plotting commands each time you want to regenerate the plot.

Revise is targeted at _code_, but you’re trying to get it to work on _data_. That’s a different task and one that you should instead be using Observables for.

---

<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:** [March 1, 2021, 6:11am UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/16 "2021-03-01T06:11:33Z")

</div>

If you include code again where an observable is defined, and change the value, if revise runs that again you have a new observable and your plot will still look the same. If you want the plot to change you have to mutate the exact observables that are connected to it. But if you’re just iteratively building a plot that’s not the use case for observables. It should really not take long to just return a new scene again and again.

---

<div class="post-metadata">

**Author:** ![danvenn](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@danvenn](https://discourse.julialang.org/u/danvenn)\
**Post date:** [March 1, 2021, 2:09pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195/17 "2021-03-01T14:09:13Z")

</div>

Thanks guys, yeah I think I was moving the goalposts a little! Not too much effort to hit ↑ ⏎ in terminal.
