[英]Control the size of points in an R scatterplot?
在R中, plot()
函數采用pch
參數來控制繪圖中點的外觀。 我正在制作具有數萬個點的散點圖,並且更喜歡一個小的但不是太小的點。 基本上,我發現pch='.'
太小了,但pch=19
太胖了。 有什么東西在中間或某種方式來縮小點以某種方式?
嘗試cex
參數:
?par
cex
正如rcs所說, cex
將完成基礎圖形包的工作。 我想,你是不是願意做你的圖表中ggplot2
但如果這樣做,有一個size
的審美屬性,你可以很容易地控制( ggplot2
具有用戶友好的功能參數:而不是鍵入cex
(字符擴展),在ggplot2
你可以輸入例如size = 2
,你會得到2mm點)。
這是一個例子:
### base graphics ###
plot(mpg ~ hp, data = mtcars, pch = 16, cex = .9)
### ggplot2 ###
# with qplot()
qplot(mpg, hp, data = mtcars, size = I(2))
# or with ggplot() + geom_point()
ggplot(mtcars, aes(mpg, hp), size = 2) + geom_point()
# or another solution:
ggplot(mtcars, aes(mpg, hp)) + geom_point(size = 2)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.