Figure not defined

I was following the JuliaCon 2021 youtube video: Deep dive with makie layout and I ran into problems with the very first line of code that I wrote to use the makie package:

using CairoMakie
using CairoMakie.FileIO
 
f = Figure(resolution = (1000, 800))

I get the following error:

ERROR: UndefVarError: Figure not defined
Stacktrace:
 [1] top-level scope

versioninfo()
Julia Version 1.6.2
Commit 1b93d53fc4 (2021-07-14 15:36 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i5-4570S CPU @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, haswell)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS =

Any idea why?

I can’t reproduce

jl_AE5UqL) pkg> st
      Status `/tmp/jl_AE5UqL/Project.toml`
  [13f3f980] CairoMakie v0.6.5

julia> using CairoMakie

julia> using CairoMakie.FileIO

julia> Figure(resolution = (1000, 800))
Scene (1000px, 800px):
  0 Plots
  0 Child Scenes

What’s the output of st for you?


(@v1.6) pkg> st
      Status `~/.julia/environments/v1.6/Project.toml`
  [537997a7] AbstractPlotting v0.12.18
  [cbdf2221] AlgebraOfGraphics v0.2.3
  [6e4b80f9] BenchmarkTools v1.1.4
  [ad839575] Blink v0.12.5
  [336ed68f] CSV v0.8.5
  [13f3f980] CairoMakie v0.3.4
  [a93c6f00] DataFrames v1.2.2
  [5789e2e9] FileIO v1.11.0
  [713c75ef] Franklin v0.10.47
  [28b8d3ca] GR v0.58.1
  [bd48cda9] GraphRecipes v0.5.6
  [d0351b0e] InspectDR v0.4.3
  [c601a237] Interact v0.10.3
  [ee78f7c6] Makie v0.11.1
  [47be7bcc] ORCA v0.5.0
  [f0f68f2c] PlotlyJS v0.15.0
  [91a5bcdd] Plots v1.21.1
  [65254759] StatsMakie v0.2.3
  [f3b207a7] StatsPlots v0.14.26
  [b8865327] UnicodePlots v2.0.0

Also, when I look at the documentation of Makie, I see usage of Scene in some places and usage of Figure in other places. Scene works fine but Figure doesn’t.

You have a very old version installed. Try ]up or use a seperate environment (you can create a temporary one using ]activate --temp or ]activate ./path/to/env) for experiments with new packages.

I tried ]up but it doesn’t end up updating the packages

@v1.6) pkg> up
    Updating registry at `~/.julia/registries/General`
  No Changes to `~/.julia/environments/v1.6/Project.toml`
  No Changes to `~/.julia/environments/v1.6/Manifest.toml`

In such cases you need to do ]add CairoMakie@version where version is the latest one, then you’ll be told why it can’t be installed.

1 Like

Very helpful. Thank you so much. WebIO and other packages required specific versions that were causing Makie to not be upgraded to latest version. Removing those packages and upgrading CairoMakie helped resolve the issue.