Bug 15812 - par(bg='transparent') not affecting svg
Summary: par(bg='transparent') not affecting svg
Status: NEW
Alias: None
Product: R
Classification: Unclassified
Component: Graphics (show other bugs)
Version: R 3.0.2
Hardware: x86_64/x64/amd64 (64-bit) Linux
: P5 normal
Assignee: R-core
Depends on:
Reported: 2014-05-29 14:01 UTC by _F_
Modified: 2014-06-11 09:27 UTC (History)
0 users

See Also:

test.svg with white background instead of expected transparent background (18.24 KB, image/svg+xml)
2014-05-29 14:01 UTC, _F_

Note You need to log in before you can comment on or make changes to this bug.
Description _F_ 2014-05-29 14:01:20 UTC
Created attachment 1607 [details]
test.svg with white background instead of expected transparent background

Setting background to transparent via par(bg='transparent') seems to not trigger a transparent background of svg devices, although it works for other colors with svg devices and for other devices with transparent.

How to reproduce:

# works fine
png('test.png'); par(bg='transparent'); plot(1:10); dev.off()

# works fine too
svg('test.svg'); par(bg='blue'); plot(1:10); dev.off()

# white background added?
svg('test.svg'); par(bg='transparent'); plot(1:10); dev.off()
Comment 1 _F_ 2014-06-11 09:27:42 UTC
Workaround: stating the bg argument directly in the graphics device to transparent seems to work for all devices:

png('test.png', bg='transparent'); plot(1:10); dev.off()
svg('test.svg', bg='transparent'); plot(1:10); dev.off()

As far as I understand setting par(bg='transparent') should (but does not) work for png as well as for svg.