No plot with CairoMakie

I have tried the tutorial and I do not see any plot under Windows 10

julia> using CairoMakie
julia> x = range(0, 10, length=100);
julia> y = sin.(x);
julia> lines(x, y)
Scene (800px, 600px):
  18 Plots:
    ├ Poly{Tuple{Vector{Vector{Point{2, Float32}}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ Annotations{Tuple{Vector{Tuple{String, Point{2, Float32}}}}}
    ├ Makie.Text{Tuple{String}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ Annotations{Tuple{Vector{Tuple{String, Point{2, Float32}}}}}
    ├ Makie.Text{Tuple{String}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    └ Makie.Text{Tuple{String}}
  1 Child Scene:
    └ Scene (728px, 541px)
julia> versioninfo()
Julia Version 1.6.2
Commit 1b93d53fc4 (2021-07-14 15:36 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
(@v1.6) pkg> st
      Status `C:\Users\michele.zaffalon\.julia\environments\v1.6\Project.toml`
  [28f2ccd6] ApproxFun v0.12.5
  [6e4b80f9] BenchmarkTools v1.1.1
  [e2ed5e7c] Bijections v0.1.3
  [ad839575] Blink v0.12.5
  [336ed68f] CSV v0.8.5
  [13f3f980] CairoMakie v0.5.10
  [8f4d0f93] Conda v1.5.2
  [f65535da] Convex v0.14.11
  [a93c6f00] DataFrames v1.2.0
  [864edb3b] DataStructures v0.18.9
  [31a5f54b] Debugger v0.6.8
  [e2685f51] ECOS v0.12.2
  [b305315f] Elliptic v1.0.1
  [7a1cc6ca] FFTW v1.4.3
  [5789e2e9] FileIO v1.10.1
  [f6369f11] ForwardDiff v0.10.18
  [19dc6840] HCubature v1.5.0
  [f67ccb44] HDF5 v0.15.5
  [7073ff75] IJulia v1.23.2
  [6218d12a] ImageMagick v1.2.1
  [916415d5] Images v0.24.1
  [a98d9a8b] Interpolations v0.13.3
  [682c06a0] JSON v0.21.1
  [b964fa9f] LaTeXStrings v1.2.1
  [a05a14c7] LibSerialPort v0.5.0
  [9c8b4983] LightXML v0.9.0
  [2fda8390] LsqFit v0.12.1
  [cdf4abc8] MPFR_wrap v0.1.0 `https://github.com/mzaffalon/MPFR_wrap.jl#master`
  [76087f3c] NLopt v0.6.3
  [6fe1bfb0] OffsetArrays v1.10.3
  [bac558e1] OrderedCollections v1.4.1
  [f0f68f2c] PlotlyJS v0.18.0
  [c3e4b0f8] Pluto v0.15.1
  [f27b6e38] Polynomials v1.2.1
  [438e738f] PyCall v1.92.3
  [d330b81b] PyPlot v2.9.0
  [1fd47b50] QuadGK v2.4.1
  [295af30f] Revise v3.1.17
  [c946c3f1] SCS v0.7.1
  [90137ffa] StaticArrays v1.2.7
  [24249f21] SymPy v1.0.50
  [1986cc42] Unitful v1.9.0
  [276b4fcb] WGLMakie v0.3.5
  [0f1e0344] WebIO v0.8.15
  [ddb6d928] YAML v0.4.7

There will be no plot display in the normal Julia REPL. You need to have some sort of environment that can display png / svg MIME types. Examples are VSCode, Atom, Pluto, ElectronDisplay.jl, etc.

3 Likes

If you’re just working in the REPL I believe you need to call save manually.

From the manual:

To see the output of plotting commands when using CairoMakie, we recommend you either use an IDE which supports png or svg output, such as VSCode, Atom/Juno, Jupyter, Pluto, etc., or try using a viewer package such as ElectronDisplay.jl, or alternatively save your plots to files directly. The Julia REPL by itself does not have the ability to show plots.

Thank you for the answers and sorry for the noise.