简体   繁体   中英

how to control the width and length of ggplot with increased resolution using ggsave

After creating a ggplot with resolution 300 dpi the main problem faced are the dimensions of the graph. the command used is

p <- 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('C:/Users/Nido/Desktop/test.tiff', p, device = "tiff", dpi = 300, 
       width=12, height=16, unit = "in")

with above command there is no output in plot area.

and by changing the position of below portion of command the error is 'can't identify "unit"'

width=12, height=16, unit = "in"

how can i adjust the length and width of the graph. Your help will be highly appreciated

Try unit in plural - so units = "in"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM