Reputation: 939
I'm creating a presentation in powerpoint and need to copy and paste some charts created in R to the presentation. While I do know I can create presentations using rmarkdown, I need to use really small text and paste multiple charts side by side along with multiple tables to fit into a 5 page presentation and I'm not really sure how to do so using rmarkdown, so I'm creating the presentation manually. However when I reside charts from R in the powerpoint, they loose the sharpness and get blurry. See example below -
Is there a way to resize my charts from R and paste manually in a powerpoint, while still keeping the photos sharp. See reproducible code below -
data <- mutate(mtcars, car.name = row.names(mtcars))
data %>%
slice(1:20) %>%
ggplot(aes(mpg, car.name))+
geom_col()+
geom_text(aes(label = mpg))+
theme_bw()+
labs(title = "MPG by Car Brand", x = "", y = "")+
theme(plot.title = element_text(face = "bold"),
axis.text.y = element_text(size = 12),
axis.text.x = element_text(size = 12))
Upvotes: 0
Views: 323
Reputation: 818
first set a directory using
setwd()
then you could use just "ggsave()", and set both height and width
ggsave("My_plot.jpg", My_Plot, width = 4, height = 6 )
The plot should be saved at the directory you just defined. You could also just paste the whole direction when defining the file's name.
Upvotes: 1