How to use CairoMakie?

I can’t figure out, how to use Makie with CairoMakie and neither found tutorials on it.
What I tried:

(RealTimePlot-julia) pkg> st
    Status `C:\Users\EMI\Documents\cstamas_SVN\cstamas\JuliaRobotics\RealTimePlot-julia\Project.toml`
  [537997a7] AbstractPlotting v0.9.8
  [13f3f980] CairoMakie v0.1.1
  [864edb3b] DataStructures v0.15.0
  [fc18253b] LazyJSON v0.1.1
  [510215fc] Observables v0.2.3
  [731186ca] RecursiveArrayTools v0.20.0

julia> using CairoMakie, AbstractPlotting

julia> scatter(rand(10))
ERROR: MethodError: no method matching isnan(::Point{2,Float32})
Closest candidates are:
  isnan(::BigFloat) at mpfr.jl:879
  isnan(::Missing) at missing.jl:83
  isnan(::Float16) at float.jl:530
  ...
Stacktrace:
 [1] minmax at C:\Users\EMI\.julia\packages\GeometryTypes\TFiQ7\src\hyperrectangles.jl:177 [inlined]
 [2] GeometryTypes.HyperRectangle{3,Float32}(::Array{Point{2,Float32},1}) at C:\Users\EMI\.julia\packages\GeometryTypes\TFiQ7\src\hyperrectangles.jl:202
 [3] atomic_limits(::Scatter{...}) at C:\Users\EMI\.julia\packages\AbstractPlotting\zoqRL\src\layouting\data_limits.jl:16
 [4] data_limits(::Scatter{...}) at C:\Users\EMI\.julia\packages\AbstractPlotting\zoqRL\src\layouting\data_limits.jl:9
 [5] data_limits(::Array{AbstractPlot,1}) at C:\Users\EMI\.julia\packages\AbstractPlotting\zoqRL\src\layouting\data_limits.jl:111
 [6] data_limits at C:\Users\EMI\.julia\packages\AbstractPlotting\zoqRL\src\layouting\data_limits.jl:119 [inlined]
 [7] update_limits!(::Scene, ::AbstractPlotting.Automatic, ::Vec{3,Float32}) at C:\Users\EMI\.julia\packages\AbstractPlotting\zoqRL\src\interfaces.jl:670
 [8] update_limits!(::Scene) at C:\Users\EMI\.julia\packages\AbstractPlotting\zoqRL\src\interfaces.jl:666
 [9] plot!(::Scene, ::Type{Scatter{...}}, ::Attributes, ::Tuple{Observables.Observable{Array{Float64,1}}}, ::Observables.Observable{Tuple{Array{Point{2,Float32},1}}}) at C:\Users\EMI\.julia\packages\AbstractPlotting\zoqRL\src\interfaces.jl:558
 [10] #plot!#195(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Scene, ::Type{Scatter{...}}, ::Attributes, ::Array{Float64,1}) at C:\Users\EMI\.julia\packages\AbstractPlotting\zoqRL\src\interfaces.jl:515
 [11] #scatter#136 at C:\Users\EMI\.julia\packages\AbstractPlotting\zoqRL\src\interfaces.jl:484 [inlined]
 [12] scatter(::Array{Float64,1}) at C:\Users\EMI\.julia\packages\AbstractPlotting\zoqRL\src\recipes.jl:11
 [13] top-level scope at none:0

julia> versioninfo()
Julia Version 1.1.1
Commit 55e36cc308 (2019-05-16 04:10 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, sandybridge)

That error unrelated to CairoMakie and a side effect of you being on StaticArrays#master!
I just merged: https://github.com/JuliaGeometry/GeometryTypes.jl/pull/172
I’ll tag it once StaticArrays got tagged!

1 Like

Btw, there is a working notebook for CairoMakie that you can remix:

1 Like

Not sure why is that, but I added StaticArrays#master and GeometryTypes#master and didn’t get the error. However the plot is not showing up (I tried AbstractPlotting.__init__() and display(AbstractPlotting.PlotDisplay(), scene); too).

In the REPL, there is currently no display backend available for Cairo - you need to use it in Atom/IJulia or Nextjournal :wink:

Ohh did not know that.
Thank your for all the help!

Ah, I got the same error with Makie:

julia> scatter([1,2,3],[4,5,6])
ERROR: MethodError: no method matching isnan(::Point{2,Float32})
Closest candidates are:
  isnan(::BigFloat) at mpfr.jl:879
  isnan(::Missing) at missing.jl:83
  isnan(::Float16) at float.jl:530

and

julia> meshscatter([[1,2,3],[4,5,6]])
ERROR: No overload for MeshScatter{...} and also no overload for trait AbstractPlotting.PointBased() found! Arguments: (Array{Array{Int64,1},1},)

I did not install StaticArrays#master explicitly, so don’t understand how this happened, but pkg> add StaticArrays solved the issue.