You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unsure if this is due to my incorrect usage but I cannot save a plot when using ggdraw+draw_grob, is this possible? This does not work with ggsave or save_plot, it produces an error noting an invalid canvas value. As below.
``` r
library(here)
#> here() starts at [removed]
library(tidyverse)
#> Warning: replacing previous import 'vctrs::data_frame' by 'tibble::data_frame'
#> when loading 'dplyr'
library(grid)
library(cowplot)
plot <- ggplot(mpg, aes(x = hwy, y = cty)) +
geom_point()
line <- linesGrob(x = unit(c(0,1), "npc"), y = unit(c(0,1), "npc"))
plot_full <- ggdraw(plot) +
draw_grob(line)
ggsave("plotfull.png", plot_full, path = here())
#> Saving 7 x 5 in image
#> Error in grDevices::png(..., res = dpi, units = "in"): invalid value of 'canvas'
save_plot("plotfull.png", plot_full)
#> Error in grDevices::png(..., res = dpi, units = "in"): invalid value of 'canvas'
I cannot reproduce this issue. You'll have to do some more digging. Can you save any plots? Can you save plot? Which combination of package trigger the issue?
Yes, saving just 'plot' works fine. Using the export function in Rstudio works with plot_full . I have also attempted with just ggplot2, grid, and cowplot and it does not seem to work.
While the presence of the cowplot package seems to trigger this issue, I'm not convinced this is actually a cowplot bug. And also, I can't reproduce the issue. I suggest you ask on stackoverflow, where a larger audience can see this. Maybe somebody else can reproduce this and figure out where things go wrong.
I am unsure if this is due to my incorrect usage but I cannot save a plot when using ggdraw+draw_grob, is this possible? This does not work with ggsave or save_plot, it produces an error noting an invalid canvas value. As below.
Created on 2020-09-14 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: