简体   繁体   English

如何使用 ggsave 以提高分辨率来控制 ggplot 的宽度和长度

[英]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.创建分辨率为 300 dpi 的 ggplot 后,面临的主要问题是图形的尺寸。 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.使用上述命令,plot 区域中没有 output。

and by changing the position of below portion of command the error is 'can't identify "unit"'并通过更改以下命令部分的 position 错误是“无法识别“单元”

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"尝试以复数形式使用单位 - 所以units = "in"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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