# AbstractPlotting Example Won't Work After I Change it to Makie

**URL:** <https://discourse.julialang.org/t/abstractplotting-example-wont-work-after-i-change-it-to-makie/92593>\
**Category:** General Usage\
**Tags:** package\
**Created:** [January 6, 2023, 8:34am UTC](https://discourse.julialang.org/t/abstractplotting-example-wont-work-after-i-change-it-to-makie/92593 "2023-01-06T08:34:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [January 6, 2023, 8:34am UTC](https://discourse.julialang.org/t/abstractplotting-example-wont-work-after-i-change-it-to-makie/92593/1 "2023-01-06T08:34:24Z")

</div>

Hi all,

I saw this link:

[https://juliaplots.org/MakieReferenceImages/gallery//streamplot\_animation/index.html](https://juliaplots.org/MakieReferenceImages/gallery//streamplot_animation/index.html)

I want to create the animation, but it said that “everything from AbstractPlotting is moved to Makie” thus I even modify it to this:

```julia
using Makie

v(x::Point2{T}, t) where T = Point2{T}(one(T) * x[2] * t, 4 * x[1])

sf = Node(Base.Fix2(v, 0e0))

title_str = Node("t = 0.00")

sp = Makie.streamplot(
        sf,
        -2..2, -2..2;
        linewidth = 2,
        padding = (0, 0),
        arrow_size = 0.09,
        colormap =:magma
    )

sc = title(sp, title_str)

record(sc, "output.mp4", LinRange(0, 20, 5*30)) do i
  sf[] = Base.Fix2(v, i)
  title_str[] = "t = $(round(i; sigdigits = 2))"
end

```

The errors:  
_LoadError: MethodError: no method matching pixelarea(::Makie.FigureAxisPlot)_  
_Closest candidates are:_

- pixelarea(::AbstractPlotting.Scene) at ~/.julia/packages/AbstractPlotting/2A5iv/src/scenes.jl:423\*
- pixelarea(::AbstractPlotting.SceneLike) at ~/.julia/packages/AbstractPlotting/2A5iv/src/scenes.jl:424\*  
_Stacktrace:_
- [1] title(scene::Makie.FigureAxisPlot, tstring::Observable{String}; align::Tuple{Symbol, Symbol}, textsize::Int64, parent::AbstractPlotting.Scene, formatter::Function, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})\*
- @ AbstractPlotting ~/.julia/packages/AbstractPlotting/2A5iv/src/basic\_recipes/title.jl:15\*
- [2] title(scene::Makie.FigureAxisPlot, tstring::Observable{String})\*
- @ AbstractPlotting ~/.julia/packages/AbstractPlotting/2A5iv/src/basic\_recipes/title.jl:13\*
- [3] top-level scope\*
- @ ~/LasthrimProjection/ProjectGLMakie/plotgl.jl:18\*
- [4] include(fname::String)\*
- @ Base.MainInclude ./client.jl:451\*
- [5] top-level scope\*
- @ REPL[12]:1\*  
_in expression starting at /home/browni/LasthrimProjection/ProjectGLMakie/plotgl.jl:18_

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [January 6, 2023, 9:22am UTC](https://discourse.julialang.org/t/abstractplotting-example-wont-work-after-i-change-it-to-makie/92593/2 "2023-01-06T09:22:50Z")

</div>

The example is outdated, but you yourself seem to be using an older version of Makie. `Node` has been deprecated in favor of `Observable`.

Which version are you on?

On `Makie v0.19.1` this produces the desired animation

```julia
using GLMakie # or CairoMakie

v(x::Point2{T}, t) where T = Point2{T}(one(T) * x[2] * t, 4 * x[1])

sf = Observable(Base.Fix2(v, 0e0))

title_str = Observable("t = 0.00")

fig, ax, sp = Makie.streamplot(
               sf,
               -2..2, -2..2;
               linewidth = 2,
               figure=(padding = (0, 0),),
               axis=(title=title_str,),
               arrow_size = 0.09,
               colormap =:magma
           )

record(fig, "output.mp4", LinRange(0, 20, 5*30)) do i
  sf[] = Base.Fix2(v, i)
  title_str[] = "t = $(round(i; sigdigits = 2))"
end

```

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [January 6, 2023, 9:32am UTC](https://discourse.julialang.org/t/abstractplotting-example-wont-work-after-i-change-it-to-makie/92593/3 "2023-01-06T09:32:21Z")

</div>

This is the version

```julia
   Status `~/LasthrimProjection/ProjectGLMakie/Project.toml`
  [35d6a980] ColorSchemes v3.20.0
  [e9467ef8] GLMakie v0.4.5
  [ee78f7c6] Makie v0.15.1
  [37e2e46d] LinearAlgebra

```

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [January 6, 2023, 9:37am UTC](https://discourse.julialang.org/t/abstractplotting-example-wont-work-after-i-change-it-to-makie/92593/4 "2023-01-06T09:37:33Z")

</div>

That’s a really old version. Any particular reason why you don’t use a recent one?  
Makie has seen some amazing improvements since then. But also quite a few breaking changes. I’d say better learn the current system now than cling to the old.

By the way, you should have gotten an error saying `title` is undefined. You didn’t because `AbstractPlotting` was still loaded. It’s no longer required.

But actually the same code I posted above works with the older Makie.

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [January 6, 2023, 10:14am UTC](https://discourse.julialang.org/t/abstractplotting-example-wont-work-after-i-change-it-to-makie/92593/5 "2023-01-06T10:14:29Z")

</div>

As @skleinbo you should really upgrade your packages if possible.

And here’s a simplified version of the code (tested with Makie 0.19.1) that’s probably easier to understand:

```julia
using CairoMakie

time = Observable(0.0)

sf = @lift p -> Point2(p[2] * $time, 4 * p[1])
title = @lift string("t = ", round($time; sigdigits=2))

fig = Makie.streamplot(
        sf,
        -2..2, -2..2;
        linewidth=2,
        colormap=:magma,
        axis=(; title),
       )

@time record(fig, "output.mp4", range(0, 20, 5*30)) do t
    time[] = t
end

```

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [January 6, 2023, 10:45am UTC](https://discourse.julialang.org/t/abstractplotting-example-wont-work-after-i-change-it-to-makie/92593/6 "2023-01-06T10:45:18Z")

</div>

I just add it and it is installed that version. I will use the recent one.

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [January 6, 2023, 10:50am UTC](https://discourse.julialang.org/t/abstractplotting-example-wont-work-after-i-change-it-to-makie/92593/7 "2023-01-06T10:50:39Z")

</div>

> [@sijo](#):
>
> ```julia
> using CairoMakie
> 
> time = Observable(0.0)
> 
> sf = @lift p -> Point2(p[2] * $time, 4 * p[1])
> title = @lift string("t = ", round($time; sigdigits=2))
> 
> fig = Makie.streamplot(
> sf,
> -2..2, -2..2;
> linewidth=2,
> colormap=:magma,
> axis=(; title),
> )
> 
> @time record(fig, "output.mp4", range(0, 20, 5*30)) do t
> time[] = t
> end
> 
> ```

I have a question why would when I add Makie in another project environment it is the version `0.15.1` but in another project environment I made quite a long time ago, Makie that I added is already version `0.18.1`

You give CairoMakie example and I will test it in different env.

 ![Capture d’écran_2023-01-06_17-47-11](https://global.discourse-cdn.com/julialang/original/3X/0/c/0c729bd05c945b68afcf1ecb2417ec67a5cf4651.png)

I think Makie team should be making books of tutorial like `SciPy` created books for documentation with the code or like `CalculusWithJulia` so people can follow up the newest upgrade.

The code works:

 ![Capture d’écran_2023-01-06_17-50-07](https://global.discourse-cdn.com/julialang/original/3X/b/d/bd3d967e3b6c586994fbd6dc9e0454320ac08c25.png)

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [January 6, 2023, 11:05am UTC](https://discourse.julialang.org/t/abstractplotting-example-wont-work-after-i-change-it-to-makie/92593/8 "2023-01-06T11:05:13Z")

</div>

> [@Freya\_the\_Goddess](#):
>
> why would when I add Makie in another project environment it is the version `0.15.1`

Have you updated that environment?

> [@Freya\_the\_Goddess](#):
>
> I think Makie team should be making books of tutorial like `SciPy` created books for documentation with the code or like `CalculusWithJulia` so people can follow up the newest upgrade.

Ideally an up-to-date and pedagogical documentation with many examples would exist. But that’s a lot of work to maintain. I personally find the current Makie documentation mostly sufficient. And who knows if CalculusWithJulia will be kept up to date in the long run.

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [January 6, 2023, 11:17am UTC](https://discourse.julialang.org/t/abstractplotting-example-wont-work-after-i-change-it-to-makie/92593/9 "2023-01-06T11:17:26Z")

</div>

To elaborate on @skleinbo’s answer: in this old project you have an old version of GLMakie. When you install Makie there, it picks a version compatible with this old GLMakie. Try running `]update` in that project.

It would be great to have a book on Makie, but it’s probably too early. Keep in mind that SciPy is a very mature project (\>20 years old!). It’s very stable so people can put a lot of effort in extensive documentation and it will be valid for years to come.

On the other hand Makie is still a young project that’s evolving fast. It’s not stable (it hasn’t reached 1.0 yet). Every year there are several releases with breaking changes. If you write a book now it will be outdated in a few months.

By the way note that it took 16 years for SciPy to reach version 1.0. That happended around the same time that Makie had its first commit (end of 2017). I’m hopeful Makie will reach 1.0 before 2033 🙂

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [January 6, 2023, 11:36am UTC](https://discourse.julialang.org/t/abstractplotting-example-wont-work-after-i-change-it-to-makie/92593/10 "2023-01-06T11:36:09Z")

</div>

Wow, thanks a lot for the explanation. Indeed Julia is still new too born on 2012.

I just know that SciPy is that old.

You must be the master of Computer, Julia and Makie, thus can make me understand why writing Makie book is not a wise thing to do now…

Makie is great, but there are lots of plotting packages (GR, PlotlyJS, PyPlot, Gaston) in Julia, should we make vote or make competition for them all in all fields of science?
