# Probably stupid plotting question in regards to saving figures

**URL:** <https://discourse.julialang.org/t/probably-stupid-plotting-question-in-regards-to-saving-figures/68381>\
**Category:** New to Julia\
**Tags:** question, plots\
**Created:** [September 18, 2021, 6:43pm UTC](https://discourse.julialang.org/t/probably-stupid-plotting-question-in-regards-to-saving-figures/68381 "2021-09-18T18:43:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![charperflow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/charperflow/32/22252_2.png) [@charperflow](https://discourse.julialang.org/u/charperflow)\
**Post date:** [September 18, 2021, 6:43pm UTC](https://discourse.julialang.org/t/probably-stupid-plotting-question-in-regards-to-saving-figures/68381/1 "2021-09-18T18:43:04Z")

</div>

I do not understand why my following code does not work:

```julia
#crit_theta.jl
using Plots

deg = 5
rad = deg/360 * 3.14159
a = 0.15
α = -0.9
f(x) = ((tand(x)-tand(deg))/a)^α

plt = plot(f,
           5.1,
           15,
           title = "Bed height vs. critical angle",
           xlabel = "Critical angle θ",
           ylabel = "Dimensionless height h/d",
           xlims = (4,15),
           ylims = (0,25),
           legend = false
           )

savefig(plt,"height_v_theta.png")
~                                     

```

When I run this, I get the following error:

```julia
ERROR: MethodError: objects of type Tuple{Plots.Plot{Plots.GRBackend}, String} are not callable
Stacktrace:
 [1] top-level scope
   @ REPL[29]:1

```

If I comment out the line for savefig, everything runs fine. Furthermore if I just type plt in the repl my plot displays perfectly. I am doubly confused because I thought savefig specifically took objects of type Tuple{Plots.Plot{Plots.GRBackend}, String}…am I missing something super obvious?

---

<div class="post-metadata">

**Author:** ![fipelle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fipelle/32/4772_2.png) [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Post date:** [September 18, 2021, 6:49pm UTC](https://discourse.julialang.org/t/probably-stupid-plotting-question-in-regards-to-saving-figures/68381/2 "2021-09-18T18:49:07Z")

</div>

> [@charperflow](#):
>
> ```julia
> #crit_theta.jl
> using Plots
> 
> deg = 5
> rad = deg/360 * 3.14159
> a = 0.15
> α = -0.9
> f(x) = ((tand(x)-tand(deg))/a)^α
> 
> plt = plot(f,
> 5.1,
> 15,
> title = "Bed height vs. critical angle",
> xlabel = "Critical angle θ",
> ylabel = "Dimensionless height h/d",
> xlims = (4,15),
> ylims = (0,25),
> legend = false
> )
> 
> savefig(plt,"height_v_theta.png")
> 
> ```

Works on my side.

![height_v_theta](https://global.discourse-cdn.com/julialang/original/3X/b/e/bee3c441ecde6069581a5be39d824dd5d30c6c06.png)

What version of Julia / Plots are you using?

---

<div class="post-metadata">

**Author:** ![charperflow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/charperflow/32/22252_2.png) [@charperflow](https://discourse.julialang.org/u/charperflow)\
**Post date:** [September 18, 2021, 6:50pm UTC](https://discourse.julialang.org/t/probably-stupid-plotting-question-in-regards-to-saving-figures/68381/3 "2021-09-18T18:50:49Z")

</div>

Good to know I’m not missing something obvious. I am running Julia 1.6.2 and my Plots package is version 1.21.3

---

<div class="post-metadata">

**Author:** ![fipelle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fipelle/32/4772_2.png) [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Post date:** [September 18, 2021, 6:52pm UTC](https://discourse.julialang.org/t/probably-stupid-plotting-question-in-regards-to-saving-figures/68381/4 "2021-09-18T18:52:29Z")

</div>

Same version of Julia, but I am using Plots 1.22.1. They might have changed the order of the savefig arguments at some point. Can you try updating it to 1.22.1?

---

<div class="post-metadata">

**Author:** ![charperflow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/charperflow/32/22252_2.png) [@charperflow](https://discourse.julialang.org/u/charperflow)\
**Post date:** [September 18, 2021, 6:53pm UTC](https://discourse.julialang.org/t/probably-stupid-plotting-question-in-regards-to-saving-figures/68381/5 "2021-09-18T18:53:09Z")

</div>

sure, Ill do that right now!

---

<div class="post-metadata">

**Author:** ![charperflow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/charperflow/32/22252_2.png) [@charperflow](https://discourse.julialang.org/u/charperflow)\
**Post date:** [September 18, 2021, 6:58pm UTC](https://discourse.julialang.org/t/probably-stupid-plotting-question-in-regards-to-saving-figures/68381/6 "2021-09-18T18:58:44Z")

</div>

That fixed it. I’ll make sure to update all my packages before I post a question next time. Thanks for the help 🙂
