我想使用R绘制一个〜100,000个数字条目的小节图.情节将是密集的,这就是我想要的.到目前为止,我正在使用以下代码:
I would like to use R to make a barplot of ~100,000 numerical entries. The plot will be dense, which is what I want. So far I am using the following code:
sample_var <- c(2,5,3,2,3,2,6,10,20,...) #Filled with 100,000 entries barplot(sample_var)生成的图正是我想要的,但是它是一个正方形,而我想要一个长矩形.有没有一种方法可以设置条形图的尺寸?我想将长x高指定为10:1的宽高比,或将1000px x 10px设置为特定的像素.我尝试在barplot函数语句中使用 xlim ,但收到无效的xlim"警告.
The resulting plot is just what I want, but it is a square, whereas I want a long rectangle. Is there a way to set the dimensions of the barplot? I would like to specific an aspect ratio of 10:1 for length x height, or a specific pixel setting of 1000px x 10px. I tried using xlim in the barplot function statement, but get an "invalid xlim" warning.
感谢您的帮助!
推荐答案在输出到文件时设置 width 和 hight :
Set the width and hight when outputting to a file:
png(filename="figures.png", width=800, height=200, bg="white") sample_var <- c(2,5,3,2,3,2,6,10,20) barplot(sample_var) dev.off()更多推荐
使用R制作具有特定宽度的条形图?
发布评论