Gadfly SVGs render without color

gadfly

#1

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.

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


#2

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?


#3

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


#4

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.


#5

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

pkg> dev Compose

followed by

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.


#6

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.


#7

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?


#8

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

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


#9

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