ggvis icon indicating copy to clipboard operation
ggvis copied to clipboard

PNG doesn't render when using dashed lines

Open voxnonecho opened this issue 9 years ago • 0 comments

When trying to save this plot to a PNG, I noticed the dashed line doesn't render properly (they show nicely with SVG)

library(dplyr)
library(ggvis)

data.frame(group = letters[1:4],
           m = c(130, 134, 132, 105),
           s = c(20, 14, 12, 10)) %>%
  group_by(group) %>%
  do(data_frame(group = .$group,
                x = 50:200,
                y = dnorm(x, .$m, .$s),
                withinSd = abs(x - .$m) <= .$s)) %>%
  mutate(dash = ifelse(grepl("a|d", group), 5, 0),
         color = ifelse(grepl("a|c|d", group), "blue", "red"))  %>%
  ggvis() %>%
  layer_paths(~x, ~y, stroke := ~color, strokeDash := ~dash) %>%
  filter(withinSd) %>%
  layer_ribbons(~x, ~y, y2 = ~y-y, fill := ~color, fillOpacity := 0.2) %>%
  hide_legend("fill") %>%
  add_axis("y", title_offset = 50)

Using:

## [1] ggvis_0.4.2 tidyr_0.2.0 dplyr_0.4.2

voxnonecho avatar Jun 22 '15 03:06 voxnonecho