# Gadfly SVGs render without color

**URL:** https://discourse.julialang.org/t/gadfly-svgs-render-without-color/16804
**Category:** Visualization
**Tags:** gadfly
**Created:** [October 25, 2018, 7:49pm UTC](https://discourse.julialang.org/t/gadfly-svgs-render-without-color/16804 "2018-10-25T19:49:21Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![hellemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hellemo/32/324_2.png) [@hellemo](https://discourse.julialang.org/u/hellemo)
#### Post date: [October 25, 2018, 7:49pm UTC](https://discourse.julialang.org/t/gadfly-svgs-render-without-color/16804/1 "2018-10-25T19:49:22Z")

</div>

I just updated some code to work with v1.0 of Julia and Gadfly, and the SVG output from Gadfly that used to work fine with MS Office now renders without color, the svg editor Inkscape also renders it with no color.

```julia
using Gadfly, RDatasets
iris = dataset("datasets", "iris")
p = plot(iris, x=:SepalLength, y=:SepalWidth, color=:Species, Geom.point);
p |> SVG("test.svg",15cm,10cm)

```

While the resulting svg file looks like expected in a web browser, when inserted into MS Word it looks more or less like this: (png below exported to png from inkscape)

![test](https://global.discourse-cdn.com/julialang/original/3X/9/2/92c7e78466404fe1743f9cb97a2caeacba600f88.png)

---

<div class="post-metadata">

### Author: ![alejandromerchan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alejandromerchan/32/10500_2.png) [@alejandromerchan](https://discourse.julialang.org/u/alejandromerchan)
#### Post date: [October 25, 2018, 8:40pm UTC](https://discourse.julialang.org/t/gadfly-svgs-render-without-color/16804/2 "2018-10-25T20:40:39Z")

</div>

I have a similar issue. I’m using Gadfly to plot a time series with points, a line uniting the points and a lm smoothing line, saving all of them to an SVG file. The graph looks fine when I save it, but when I put it in an Open Office document, both lines disappear. Saving and copying it as a PNG doesn’t cause that. Could both issues be related?

---

<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: [October 25, 2018, 10:06pm UTC](https://discourse.julialang.org/t/gadfly-svgs-render-without-color/16804/3 "2018-10-25T22:06:03Z")

</div>

is the problem fixed by reverting [https://github.com/GiovineItalia/Compose.jl/pull/319](https://github.com/GiovineItalia/Compose.jl/pull/319) ?

---

<div class="post-metadata">

### Author: ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)
#### Post date: [October 26, 2018, 1:48am UTC](https://discourse.julialang.org/t/gadfly-svgs-render-without-color/16804/4 "2018-10-26T01:48:54Z")

</div>

At least some widespread versions of Inkscape do not recognize the `“rgba()” fill spec (used in the PR mentioned by @bjarthur) . The “fill-opacity” attribute seems to be more widely acceptable.

---

<div class="post-metadata">

### Author: ![hellemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hellemo/32/324_2.png) [@hellemo](https://discourse.julialang.org/u/hellemo)
#### Post date: [October 26, 2018, 11:04am UTC](https://discourse.julialang.org/t/gadfly-svgs-render-without-color/16804/5 "2018-10-26T11:04:31Z")

</div>

Yes, that seems to be the problem - Thanks!

One small problem remains with fill-opacity being specified twice, generating errors, but that could easily be because I reverted improperly. I did

```julia
pkg> dev Compose

```

followed by

```julia
git revert c414a3f34b5f78a6c373e7303429ec52150c23af

```

in the dev/Compose folder.

After removing one of the fill-opacity-attributes manually, the svg file works fine, both in Inkscape and MS Office.

---

<div class="post-metadata">

### Author: ![tlnagy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlnagy/32/5815_2.png) [@tlnagy](https://discourse.julialang.org/u/tlnagy)
#### Post date: [October 26, 2018, 5:18pm UTC](https://discourse.julialang.org/t/gadfly-svgs-render-without-color/16804/6 "2018-10-26T17:18:33Z")

</div>

> [@hellemo](#):
>
> One small problem remains with fill-opacity being specified twice, generating errors, but that could easily be because I reverted improperly.

I would revert to 5464bc54b87e54b2930dfce082c4478859360457 which is before the initial changes in fillopacity. The duplicate fillopacity attribute was fixed in c414a3f34b5f78a6c373e7303429ec52150c23af, but that introduced the RGBA usage.

---

<div class="post-metadata">

### Author: ![hellemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hellemo/32/324_2.png) [@hellemo](https://discourse.julialang.org/u/hellemo)
#### Post date: [October 27, 2018, 2:37pm UTC](https://discourse.julialang.org/t/gadfly-svgs-render-without-color/16804/7 "2018-10-27T14:37:03Z")

</div>

I can confirm that the svg generated using 5464bc54b87e54b2930dfce082c4478859360457 renders as expected in Inkscape.

Any chance of having the RGBA reverted in the next release, or perhaps turned off by default until it is more widely supported?

---

<div class="post-metadata">

### Author: ![tlnagy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlnagy/32/5815_2.png) [@tlnagy](https://discourse.julialang.org/u/tlnagy)
#### Post date: [October 27, 2018, 9:13pm UTC](https://discourse.julialang.org/t/gadfly-svgs-render-without-color/16804/8 "2018-10-27T21:13:39Z")

</div>

I agree that we need to fix this pronto, here’s the relevant issue:

[https://github.com/GiovineItalia/Compose.jl/issues/322](https://github.com/GiovineItalia/Compose.jl/issues/322)

I think the plan should be to revert to being compatible with SVG 1.1 spec for now, until SVG2 becomes more widely used.

---

<div class="post-metadata">

### Author: ![hellemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hellemo/32/324_2.png) [@hellemo](https://discourse.julialang.org/u/hellemo)
#### Post date: [October 28, 2018, 2:08pm UTC](https://discourse.julialang.org/t/gadfly-svgs-render-without-color/16804/9 "2018-10-28T14:08:27Z")

</div>

Great, thanks for helping out and for the work on Gadfly and Compose.
