# How to plot and save figure, by running code on unix server

**URL:** <https://discourse.julialang.org/t/how-to-plot-and-save-figure-by-running-code-on-unix-server/40109>\
**Category:** New to Julia\
**Tags:** package, plotting\
**Created:** [May 25, 2020, 5:46am UTC](https://discourse.julialang.org/t/how-to-plot-and-save-figure-by-running-code-on-unix-server/40109 "2020-05-25T05:46:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![BMval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bmval/32/7647_2.png) [@BMval](https://discourse.julialang.org/u/BMval)\
**Post date:** [May 25, 2020, 5:46am UTC](https://discourse.julialang.org/t/how-to-plot-and-save-figure-by-running-code-on-unix-server/40109/1 "2020-05-25T05:46:04Z")

</div>

How to plot and save figure, by running code on the Unix server.

Thank you in advance.

---

<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:** [May 25, 2020, 5:53am UTC](https://discourse.julialang.org/t/how-to-plot-and-save-figure-by-running-code-on-unix-server/40109/2 "2020-05-25T05:53:18Z")

</div>

What problems are you experiencing? What plotting package are you using?

FWIW in the most basic case, with `Plots.jl` it should be as simple as:

```julia
p = plot(... whatever you are plotting ...)
savefig(p, "myplot.svg")

```

---

<div class="post-metadata">

**Author:** ![BMval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bmval/32/7647_2.png) [@BMval](https://discourse.julialang.org/u/BMval)\
**Post date:** [May 25, 2020, 5:54am UTC](https://discourse.julialang.org/t/how-to-plot-and-save-figure-by-running-code-on-unix-server/40109/3 "2020-05-25T05:54:07Z")

</div>

Yes, I know it, how to save.

I have problem to plot.

---

<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:** [May 25, 2020, 6:09am UTC](https://discourse.julialang.org/t/how-to-plot-and-save-figure-by-running-code-on-unix-server/40109/4 "2020-05-25T06:09:29Z")

</div>

Okay you might want to change your title and OP then, given that it says “how to plot **and save** ”

What exactly is your problem when plotting?

---

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [May 25, 2020, 6:12am UTC](https://discourse.julialang.org/t/how-to-plot-and-save-figure-by-running-code-on-unix-server/40109/5 "2020-05-25T06:12:57Z")

</div>

And can you post the relevant code? See [Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757).

---

<div class="post-metadata">

**Author:** ![BMval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bmval/32/7647_2.png) [@BMval](https://discourse.julialang.org/u/BMval)\
**Post date:** [May 25, 2020, 9:10pm UTC](https://discourse.julialang.org/t/how-to-plot-and-save-figure-by-running-code-on-unix-server/40109/6 "2020-05-25T21:10:10Z")

</div>

I am sorry, not to enough clarify my question.  
I try this code and plot rise a error (very long message).

```julia
using Plots
ENV["GKSwstype"]="nul"
gr()
x=[1:10]
y=2*x
plot(y,x)

```

Would you help me, How to build a figure on server?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![BMval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bmval/32/7647_2.png) [@BMval](https://discourse.julialang.org/u/BMval)\
**Post date:** [May 26, 2020, 2:59am UTC](https://discourse.julialang.org/t/how-to-plot-and-save-figure-by-running-code-on-unix-server/40109/7 "2020-05-26T02:59:45Z")

</div>

The problem was resolved by Pkg.Update()
