1
votes

I am trying to create a ggplot2 figure of 300 dpi using RStudio. i tried the command

tiff("test.tiff", units="in", width=5, height=5, res=300)

ggplot(Rrib, aes(YEAR, CLUSTER)) + geom_tile(aes(fill = SAMPLE_TYPE), colour="black", size = 1.3)+ scale_fill_manual(values = c("BOTH" = "red2", "ENV" = "forestgreen", "AFP" = "orange", "NONE" = "white"))

dev.off()

But instead R studio is not showing any out put in plot area. Your kind help will be highly appreciated

1
myplot <- ggplot(...) then ggsave(myplot, "test.tiff", width = 5, height = 5, res = 300)Tung

1 Answers

1
votes

Use ggsave():

ggplot(Rrib, aes(YEAR, CLUSTER)) + geom_tile(aes(fill = SAMPLE_TYPE), colour="black", size = 1.3)+ scale_fill_manual(values = c("BOTH" = "red2", "ENV" = "forestgreen", "AFP" = "orange", "NONE" = "white"))
ggsave(‘test.tiff’,dpi=300)

In fact, the default dpi is 300, but I included the parameter in case you want to change it later.