# UndefVarError: \`savefig\` not defined

**URL:** https://discourse.julialang.org/t/undefvarerror-savefig-not-defined/107928
**Category:** New to Julia
**Tags:** makie
**Created:** [December 21, 2023, 9:25pm UTC](https://discourse.julialang.org/t/undefvarerror-savefig-not-defined/107928 "2023-12-21T21:25:12Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Midez](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Midez](https://discourse.julialang.org/u/Midez)
#### Post date: [December 21, 2023, 9:25pm UTC](https://discourse.julialang.org/t/undefvarerror-savefig-not-defined/107928/1 "2023-12-21T21:25:12Z")

</div>

Hello everyone,

After a long run and installing the newest version of Julia (1.9) I still get a frustrating error (that I have written in the title) when trying to save a figure

Here is my plain code (minimal example)

```julia
using Makie, GLMakie

f = Figure(resolution = (1920, 1280), fontsize = 36)

ax = Axis(f[1, 1], aspect = DataAspect(), backgroundcolor = "white") 
display(f)

savefig(f, "test.png")

```

I’m running it in Visual Studio

Anyone made it working? I spend a lot of time on this. Also I didn’t seem to find another function for saving a figure, else I had tried it.

---

<div class="post-metadata">

### Author: ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)
#### Post date: [December 21, 2023, 9:28pm UTC](https://discourse.julialang.org/t/undefvarerror-savefig-not-defined/107928/2 "2023-12-21T21:28:13Z")

</div>

`Makie` does not provide a function called `savefig`. You likely mean `save`.

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [December 21, 2023, 9:40pm UTC](https://discourse.julialang.org/t/undefvarerror-savefig-not-defined/107928/3 "2023-12-21T21:40:44Z")

</div>

> [@Midez](#):
>
> I spend a lot of time on this. Also I didn’t seem to find another function for saving a figure, else I had tried it.

Googling “Makie save figure”, [this is what comes at the top of the list](https://discourse.julialang.org/t/saving-makie-plot-as-is-on-the-screen/24276/2).

---

<div class="post-metadata">

### Author: ![Midez](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Midez](https://discourse.julialang.org/u/Midez)
#### Post date: [December 21, 2023, 10:27pm UTC](https://discourse.julialang.org/t/undefvarerror-savefig-not-defined/107928/4 "2023-12-21T22:27:12Z")

</div>

Thanks, I looked the whole time for saving figures in Julia generally.

Now this is not related to the question anymore, but while we are at it -

How to set the fontsize of the title and the figure individually?

If I rund

```julia
f = Figure(resolution = (1920, 1280),fontsize = 42)

ax = Axis(f[1, 1], aspect = DataAspect(), backgroundcolor = "white", spinewidth=2, 
          xticks=1:10,  
          yticks=1:10,
          xlabel = "xlabel", xlabelsize=34,
          ylabel = "ylabel",ylabelsize=34, title = "myTitle", titlefontsize = 12)

x = 1:10; y = x; 

lines!(x,y)

```

The global fontsize is set to 42 even if I specified for the title size 12

---

<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: [December 21, 2023, 10:28pm UTC](https://discourse.julialang.org/t/undefvarerror-savefig-not-defined/107928/5 "2023-12-21T22:28:52Z")

</div>

Pretty sure it’s `titlesize`, doesn’t it error with the wrong keyword?

---

<div class="post-metadata">

### Author: ![Midez](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Midez](https://discourse.julialang.org/u/Midez)
#### Post date: [December 21, 2023, 10:30pm UTC](https://discourse.julialang.org/t/undefvarerror-savefig-not-defined/107928/6 "2023-12-21T22:30:58Z")

</div>

okay great thanks, that immediately does the trick 😄
