# Finally using the amazing Makie for plotting

**URL:** <https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185>\
**Category:** New to Julia\
**Tags:** question, cairomakie\
**Created:** [July 28, 2023, 7:39am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185 "2023-07-28T07:39:19Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [July 28, 2023, 7:39am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/1 "2023-07-28T07:39:19Z")

</div>

Hello, tite,

However, it doesn’t let me save my plot, code is here

using CairoMakie

> CairoMakie.activate!(type = “svg”)
> 
> fig = Figure(pt\_per\_unit = 2)
> 
> ax = Axis(fig[1, 1], xlabel = “GQ”, ylabel = “VAF”,
> 
> title = “VAF vs GQ by DeepVariant”)
> 
> hexbin!(ax, df[:, “GQ”],df[:, “VAF”])
> 
> fig
> 
> save(“DeepVariant\_hesbin.svg”,fig)

the error is

> UndefVarError: `save` not defined

How can save be undef? It’s the keyword found in the doc  
[https://docs.makie.org/stable/documentation/backends/cairomakie/](https://docs.makie.org/stable/documentation/backends/cairomakie/)

Also examples from here say the same “save not defined” [GitHub - MakieOrg/Makie.jl: Interactive data visualizations and plotting in Julia](https://github.com/MakieOrg/Makie.jl)

what am I missing?

---

<div class="post-metadata">

**Author:** ![barucden](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barucden/32/26154_2.png) [@barucden](https://discourse.julialang.org/u/barucden)\
**Post date:** [July 28, 2023, 8:26am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/2 "2023-07-28T08:26:18Z")

</div>

You also need `using FileIO`, I think.

---

<div class="post-metadata">

**Author:** ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Post date:** [July 28, 2023, 8:37am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/3 "2023-07-28T08:37:33Z")

</div>

Can you show `] st` in the REPL? It should just work:

```julia
julia> using CairoMakie

julia> save
save (generic function with 8 methods)

```

---

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [July 28, 2023, 8:49am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/4 "2023-07-28T08:49:34Z")

</div>

CairoMakie v0.10.7

---

<div class="post-metadata">

**Author:** ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Post date:** [July 28, 2023, 8:52am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/5 "2023-07-28T08:52:51Z")

</div>

Does it happen in a fresh environment? Can you give a complete MWE? I don’t get this on v0.10.7.

---

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [July 28, 2023, 9:03am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/6 "2023-07-28T09:03:07Z")

</div>

> [@barucden](#):
>
> FileIO

yes it does work in the REPL. I am running Julia in Visual Studio, what should I do?

---

<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 28, 2023, 9:29am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/7 "2023-07-28T09:29:45Z")

</div>

Usually this means that you have two packages loaded which are exporting this name

---

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [July 28, 2023, 9:32am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/8 "2023-07-28T09:32:09Z")

</div>

Ok thanks, gonna try CairoMakie.save then?

---

<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 28, 2023, 9:33am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/9 "2023-07-28T09:33:20Z")

</div>

Yeah that should always work

---

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [July 28, 2023, 9:50am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/10 "2023-07-28T09:50:11Z")

</div>

Did the trick

---

<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 28, 2023, 9:58am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/11 "2023-07-28T09:58:54Z")

</div>

You should have seen a warning in the REPL when you first called `save`, something like this:

```julia
julia> using Plots, CairoMakie

julia> plot
WARNING: both CairoMakie and Plots export "plot"; uses of it in module Main must be qualified
ERROR: UndefVarError: `plot` not defined

```

so watch out for these.

---

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [July 28, 2023, 10:14am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/12 "2023-07-28T10:14:01Z")

</div>

Correct but as asked, I did the minimal possible so didn’t load other packages.

---

<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 28, 2023, 10:22am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/13 "2023-07-28T10:22:00Z")

</div>

That seems unlikely, as in that case your code runs without errors (as Daniel showed above, and I just confirmed running your entire example).

---

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [July 28, 2023, 10:31am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/14 "2023-07-28T10:31:27Z")

</div>

Then I am probably suffering from hallucinations and my REPL is haunted. That was a very useful comment

My code ran without error in that case of minimal package loaded as suggested

---

<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 28, 2023, 10:35am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/15 "2023-07-28T10:35:13Z")

</div>

Yes, it could be that you have not loaded anything else (we can’t check 🙂 ), that would be a very strange bug indeed. Almost a Julia bug. Let me just say that from our perspective of helping new users in this forum, it’s much more likely that a user has overlooked _something_ (startup files, env variables, old deved packages, etc.). So it’s not a critique of you per se, or that we don’t believe you. Just a very strong bayesian prior we’ve accumulated over time

---

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [July 28, 2023, 10:43am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/16 "2023-07-28T10:43:37Z")

</div>

Fair enough I accept the prior, but I really promise nothing else waw loaded. I suspect there was a misunderstanding, since I started from a script handed to me into visual studio then went to REPL. Of course it was not explicited, it’s on me. But my comment was more laughing than attacking.

---

<div class="post-metadata">

**Author:** ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Post date:** [July 28, 2023, 10:50am UTC](https://discourse.julialang.org/t/finally-using-the-amazing-makie-for-plotting/102185/17 "2023-07-28T10:50:01Z")

</div>

Usually it’s useful to comment the full result from `] st` just in case something else was actually loaded / to confirm that for others.
