# Makie error: scatter! not defined

**URL:** <https://discourse.julialang.org/t/makie-error-scatter-not-defined/83952>\
**Category:** General Usage\
**Tags:** makie\
**Created:** [July 8, 2022, 3:02pm UTC](https://discourse.julialang.org/t/makie-error-scatter-not-defined/83952 "2022-07-08T15:02:44Z")\
**Posts on this page:** 6\
**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:** [July 8, 2022, 3:02pm UTC](https://discourse.julialang.org/t/makie-error-scatter-not-defined/83952/1 "2022-07-08T15:02:44Z")

</div>

Can anyone help? I get an error of:  
**LoadError: UndefVarError: scatter! not defined**

when I run this code:

```julia
using Makie

f(x,y) = cos(x)*cos(y)*sqrt(x^2 + y^2)

x = range(-5, length = 100, stop = 5)
y = range(-5, length = 100, stop = 5)
z = f.(x, y')

Makie.surface(x, y, z, colormap = :viridis, shading = false)
scatter!([1], [1], [4], markersize = 1.0)

```

(is this happening because of inconsistency of old codes? why some syntax are not working like linspaces, etc?)

---

<div class="post-metadata">

**Author:** ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)\
**Post date:** [July 8, 2022, 3:11pm UTC](https://discourse.julialang.org/t/makie-error-scatter-not-defined/83952/2 "2022-07-08T15:11:24Z")

</div>

You only need to import Makie if you are writing library code that expects to use any of the Makie backends. When you just want to make plots, you need to import the appropriate backend. If you are running in a terminal or VSCode, that is probably GLMakie. If you want to make graphics for a paper, that is probably CairoMakie, if you are in a notebook probably WGLMakie.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [July 8, 2022, 3:11pm UTC](https://discourse.julialang.org/t/makie-error-scatter-not-defined/83952/3 "2022-07-08T15:11:56Z")

</div>

Are you sure that’s what you’re seeing? When I run your code I get:

```julia
julia> Makie.surface(x, y, z, colormap = :viridis, shading = false)
Error showing value of type Makie.FigureAxisPlot:
ERROR: No backend available!
Make sure to also `import/using` a backend (GLMakie, CairoMakie, WGLMakie).

```

As expected, as one shouldn’t use Makie directly. When I do so I get:

```julia
julia> using CairoMakie

julia> Makie.surface(x, y, z, colormap = :viridis, shading = false)
Scene (800px, 600px):
  0 Plots
  1 Child Scene:
    └ Scene (800px, 600px)

julia> scatter!([1], [1], [4], markersize = 1.0)
Scatter{Tuple{Vector{Point{3, Float32}}}}

```

So you likely imported some other package that exports `scatter!` and have a name conflict.

Make sure to run any MWE you post here in a fresh session before posting to see if there’s any hidden state in your current session causing your problem.

---

<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:** [July 9, 2022, 10:11am UTC](https://discourse.julialang.org/t/makie-error-scatter-not-defined/83952/4 "2022-07-09T10:11:41Z")

</div>

Hi @nilshg ,

Aside from technical question…

I was reading the GLMakie repo, since I am newbie to Julia. I do not understand what is the meaning of `can't use Makie directly`.

and  
`Cairo and WebGL are backend for Makie`

why Makie need backend ? Is it for plotting / rendering purpose? Can one use Plots with Makie to plot a graph?

---

<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:** [July 9, 2022, 10:27am UTC](https://discourse.julialang.org/t/makie-error-scatter-not-defined/83952/5 "2022-07-09T10:27:10Z")

</div>

Makie.jl only defines what plot objects are, it doesn’t know how to make images or vector graphics out of that information. The backends, CairoMakie, GLMakie, and WGLMakie implement different ways to turn the plot objects into rendered graphics, for example using the Cairo C library, OpenGL or WebGL.

You cannot use Plots.jl with Makie as nobody has written a working backend for Plots.jl that uses Makie.

---

<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:** [July 9, 2022, 10:42am UTC](https://discourse.julialang.org/t/makie-error-scatter-not-defined/83952/6 "2022-07-09T10:42:35Z")

</div>

Thanks for the explanation @jules , it is better to get an answer from expert who understand than just googling.
