[英]How to make geom_jitter() display points in the respective bars in grouped ggplot2 bar plot in R?
[英]R - ggplot - jitter plot with transparent data points
我想獲得一個帶有透明數據點的抖動 plot ,我使用以下代碼:
p<-ggplot(house_data,aes(x=cloudCover, y=solar_energy, color = day_night))
p<-p+geom_jitter()
p<-p+geom_point(alpha = 0.01)
p
我得到一個抖動 plot 但不幸的是我沒有得到透明的數據點。 我嘗試了不同的 alpha 值,但 plot 保持不變......我的代碼有什么問題?
您應該能夠在點幾何中使用position_jitter
。 width
和height
參數分別是 x 軸和 y 軸上的抖動量:
p<-ggplot(house_data,aes(x=cloudCover, y=solar_energy, color = day_night))
p<-p+geom_point(alpha = 0.01, position=position_jitter(height=.5, width=.5))
p
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.