# Cannot preview Gadfly saved images

**URL:** <https://discourse.julialang.org/t/cannot-preview-gadfly-saved-images/8826>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 5, 2018, 4:42am UTC](https://discourse.julialang.org/t/cannot-preview-gadfly-saved-images/8826 "2018-02-05T04:42:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yifan\_Liu](https://avatars.discourse-cdn.com/v4/letter/y/4da419/32.png) [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Post date:** [February 5, 2018, 4:42am UTC](https://discourse.julialang.org/t/cannot-preview-gadfly-saved-images/8826/1 "2018-02-05T04:42:19Z")

</div>

I am using VS Code and Solarized Dark theme. When I save a Gadfly image, I could not preview it with my image viewer (the whole image looks dark and I can barely see anything). I thought the image has dark background, however when I insert the image in my Latex file, it has a white background.

My code is like:

```julia

using Gadfly Cairo
figure_1a = plot(sample_option, x = :strike_price, y = :impvol, Geom.line);
        draw(PNG("01.png", 10inch, 10inch), figure_1a)

```

The preview is like this

 ![Screenshot%20from%202018-02-04%2022-39-57](https://global.discourse-cdn.com/julialang/original/3X/0/a/0a99cc196802ec7e551f605db843f206db12251b.png)

When I upload it to website, it is like this

 ![04](https://global.discourse-cdn.com/julialang/original/3X/e/1/e120c0d4f08bef6e0dbe5b47d6e02e2888ee7c32.png)

When I preview it with shotwell viewer, its background becomes black

 ![Screenshot%20from%202018-02-04%2022-45-33](https://global.discourse-cdn.com/julialang/original/3X/5/2/5288920ad27707901d0310de18c59d9f94b00113.png)

---

<div class="post-metadata">

**Author:** ![pasha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pasha/32/3319_2.png) [@pasha](https://discourse.julialang.org/u/pasha)\
**Post date:** [February 5, 2018, 5:00am UTC](https://discourse.julialang.org/t/cannot-preview-gadfly-saved-images/8826/2 "2018-02-05T05:00:40Z")

</div>

It’s just a transparent background. To get a white background, then just add `Theme(background_color = "white")` to your Gadfly commands… Here’s the doc page with other theme commands: [http://gadflyjl.org/stable/man/themes.html#Parameters-1](http://gadflyjl.org/stable/man/themes.html#Parameters-1)

---

<div class="post-metadata">

**Author:** ![Yifan\_Liu](https://avatars.discourse-cdn.com/v4/letter/y/4da419/32.png) [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Post date:** [February 5, 2018, 5:08am UTC](https://discourse.julialang.org/t/cannot-preview-gadfly-saved-images/8826/3 "2018-02-05T05:08:01Z")

</div>

Thanks so much! I saw these commands before, but I am not sure what options are available for them. Are there any docs covering that? For example, what values could background\_color take?

---

<div class="post-metadata">

**Author:** ![pasha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pasha/32/3319_2.png) [@pasha](https://discourse.julialang.org/u/pasha)\
**Post date:** [February 5, 2018, 5:20am UTC](https://discourse.julialang.org/t/cannot-preview-gadfly-saved-images/8826/4 "2018-02-05T05:20:04Z")

</div>

Oh man, there’s no colors() command like there is in R. It looks like they use the same color names as R, so you could use a [cheatsheet like this one](https://www.nceas.ucsb.edu/~frazier/RSpatialGuides/colorPaletteCheatsheet.pdf). The most useful thing in R for colors was Brewer colors, to make diverging palletes, colorblind friendly, and so on. The [Colors Package](https://github.com/JuliaGraphics/Colors.jl) seems to cover that, but Gadfly doesn’t seem to have fundamentals to automatically use the right kind of palette, like `scale_color_brewer()` did in R. Ah, the good old days.

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [February 5, 2018, 1:24pm UTC](https://discourse.julialang.org/t/cannot-preview-gadfly-saved-images/8826/5 "2018-02-05T13:24:10Z")

</div>

see [https://github.com/JuliaGraphics/Colors.jl/blob/master/src/names\_data.jl](https://github.com/JuliaGraphics/Colors.jl/blob/master/src/names_data.jl) or try `using Colors; keys(Colors.color_names)`

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [February 5, 2018, 1:28pm UTC](https://discourse.julialang.org/t/cannot-preview-gadfly-saved-images/8826/6 "2018-02-05T13:28:51Z")

</div>

this might be the equivalent of scale\_color\_brewer: [https://github.com/JuliaGraphics/Colors.jl#distinguishable\_colors](https://github.com/JuliaGraphics/Colors.jl#distinguishable_colors)

```julia
julia> distinguishable_colors(3)
3-element Array{ColorTypes.RGB{FixedPointNumbers.Normed{UInt8,8}},1}:
 RGB{N0f8}(0.0,0.0,0.0)  
 RGB{N0f8}(1.0,1.0,0.384)
 RGB{N0f8}(1.0,0.624,1.0)

```
