How to make a svg image of a plot that uses {ggblend}?

Hi All,

I want to make an svg image of a plot that uses colour blending from {ggblend}.

This code causes my Rstudio to crash. Any ideas why or how to fix much appreciated.

Thanks
Dave

library(tidyverse)
library(palmerpenguins)
library(ggblend)
library(svglite)

penguins |>
	ggplot() +
	blend(geom_density(aes(x = flipper_length_mm, fill = species)), blend = "multiply")

ggsave("test.svg")

Wow, that was exciting!
I think you may have found a bug. Veloraptor?

Try this:

svg("mygraph.svg")
penguins |>   ggplot() +
  blend(geom_density(aes(x = flipper_length_mm, fill = species)), blend = "multiply")
dev.off()

I think you can change from .png to .svg under the EXPORT tab.

1 Like

Awesome, thanks @jrkrideau !

Guessing that this is a bug with {svglite}. I've just added an issue there

It's annoying as I actually need to use svglite, as svg creates a svg image where the text is not editable by other software

Black magic marker? Or even a mixed set of many colours?

Good luck.

1 Like