How would I set the background color of an output SVG? #45
Answered
by
alshan
Carson Graham (Mee42)
asked this question in
Q&A
|
It seems like the default is for the SVG to be transparent, which doesn't work very well with some svg renderers such as the one built into IntelliJ. Is there any way to change this? The code I'm using to test this is: val df = mapOf(
"display" to (0..10).map { (0..10).random() },
"value" to (0..10).map { (3..35).random() }
)
val plot = lets_plot(df) {
x = "display"
y = "value"
} + geom_point(df)
ggsave(plot, "graph.svg")The outputted svg looks like this when rendered in Firefox and in IntelliJ |
Answered by
alshan
Dec 21, 2020
Replies: 1 comment 2 replies
|
That's right, there is no 'background' in SVG container - it's always transparent. One way to make it opaque is to manually add a filled rectangle before the rest of the contents: Such an option in |
2 replies
Answer selected by
Mee42
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


That's right, there is no 'background' in SVG container - it's always transparent.
One way to make it opaque is to manually add a filled rectangle before the rest of the contents:
Such an option in
ggsave()would be useful IMO.Even better would be to have an easy way to set a desirable background in IDEA SVG viewer itself - please vote: https://youtrack.jetbrains.com/issue/IDEA-250345