# Plots/GR: \`savefig\` adds transparency to my picture?

**URL:** https://discourse.julialang.org/t/plots-gr-savefig-adds-transparency-to-my-picture/93511
**Category:** General Usage
**Tags:** plotting, plots, gr
**Created:** [January 25, 2023, 2:11pm UTC](https://discourse.julialang.org/t/plots-gr-savefig-adds-transparency-to-my-picture/93511 "2023-01-25T14:11:58Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![sim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sim/32/22207_2.png) [@sim](https://discourse.julialang.org/u/sim)
#### Post date: [January 25, 2023, 2:11pm UTC](https://discourse.julialang.org/t/plots-gr-savefig-adds-transparency-to-my-picture/93511/1 "2023-01-25T14:11:58Z")

</div>

Hi, I have a curious phenomenon here which seemingly appeared from nowhere. I am doing a simple plot (using `Plots`) and saving it to a file ; but the saved version seems to be transparent.

The MWE is

```julia
using Plots
heatmap(rand(8,8))
p=plot!(aspect_ratio=:equal, colorbar=false, axis=([], false))
savefig(p, "test.png")

```

and here is what I get in my editor : left is my notebook showing the picture, right is the saved picture.

 ![savefig_transpa](https://global.discourse-cdn.com/julialang/original/3X/5/2/52f712705fde3411cce11b1b2a8a24ebd6ce2360.png)

---

<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: [January 25, 2023, 3:18pm UTC](https://discourse.julialang.org/t/plots-gr-savefig-adds-transparency-to-my-picture/93511/2 "2023-01-25T15:18:28Z")

</div>

This issue occurs while plotting with default gr backend, but not with pythonplot.

For similar result, use keyword argument `border=:none`, which works fine with gr():

```julia
p = heatmap(rand(8,8))
plot!(aspect_ratio=:equal, colorbar=false, border=:none)

```

---

<div class="post-metadata">

### Author: ![sim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sim/32/22207_2.png) [@sim](https://discourse.julialang.org/u/sim)
#### Post date: [March 31, 2023, 1:31pm UTC](https://discourse.julialang.org/t/plots-gr-savefig-adds-transparency-to-my-picture/93511/3 "2023-03-31T13:31:20Z")

</div>

Hi Rafael (and sorry for this quite late answer !).  
So there is no way to correctly save a coloured figure in the gr backend ???

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [March 31, 2023, 4:53pm UTC](https://discourse.julialang.org/t/plots-gr-savefig-adds-transparency-to-my-picture/93511/4 "2023-03-31T16:53:26Z")

</div>

@jheinen any thoughts what might be happening here?

---

<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: [March 31, 2023, 4:54pm UTC](https://discourse.julialang.org/t/plots-gr-savefig-adds-transparency-to-my-picture/93511/5 "2023-03-31T16:54:57Z")

</div>

> [@sim](#):
>
> So there is no way to correctly save a coloured figure in the gr backend ?

If you use the command that I recommended, then there is no issue with `gr()` backend. The saved figure looks good:

 ![test](https://global.discourse-cdn.com/julialang/original/3X/6/6/66f32c75a4da77b465ef2077e93f4b1f1ac4b308.png)

---

<div class="post-metadata">

### Author: ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)
#### Post date: [April 1, 2023, 8:53am UTC](https://discourse.julialang.org/t/plots-gr-savefig-adds-transparency-to-my-picture/93511/6 "2023-04-01T08:53:23Z")

</div>

For me, `p=plot!(aspect_ratio=:equal, colorbar=false, axis=([], false))` produces transparent plots both in the REPL and when saving the picture as a PNG. I’ll check it ASAP.

---

<div class="post-metadata">

### Author: ![sim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sim/32/22207_2.png) [@sim](https://discourse.julialang.org/u/sim)
#### Post date: [April 17, 2023, 7:52am UTC](https://discourse.julialang.org/t/plots-gr-savefig-adds-transparency-to-my-picture/93511/7 "2023-04-17T07:52:28Z")

</div>

Juste checked again and `border=:none` solves my question, thanks. However this behaviour is quite strange !

---

<div class="post-metadata">

### Author: ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)
#### Post date: [April 17, 2023, 12:49pm UTC](https://discourse.julialang.org/t/plots-gr-savefig-adds-transparency-to-my-picture/93511/8 "2023-04-17T12:49:09Z")

</div>

Sorry for the late reply. [This](https://github.com/JuliaPlots/Plots.jl/pull/4724) MR should fix the problem.
