df = data.frame(x = c(5, 14, 6, 10), y = c(3, 30, 17, 7))
df %>%
grob_matrix() %>%
add_structure(structure = 'column_widths_p', value = c(1, 4)) %>%
view_grob()
gg = ggplot2::ggplot(data = df, mapping = ggplot2::aes(x = x, y = y)) +
ggplot2::geom_line(color = 'red')
gg %>%
grob_image() %>%
view_grob()
Run the code above in your browser using DataLab