在r中是否有任何函數允許繪製這種散點圖,這些散點圖按組來分隔點?按r中的組繪製散點圖
這是我迄今所做的:
hours = c(0.00 ,-1.78 ,-0.50 ,-2.00 ,-2.80 ,2.00 ,-0.16 ,-0.34 ,1.00 ,1.00 ,2.00 ,-1.34 ,-1.00 ,-1.10 ,-0.43 ,-0.49 ,-0.02 ,-0.91, 0.48 ,2.33 ,1.00 ,0.00 ,1.18 ,1.29 ,-1.07 ,-0.26 ,1.96 ,0.36 ,2.00 ,-0.63 ,-0.80 ,-0.70 ,-2.00 ,1.17 ,0.67 ,-3.00)
group = c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2)
df = data.frame(hours,group)
ggplot(df, aes(group, hours)) + geom_point(shape = 16, size = 5, position = position_jitter(w=0.3,h=0.3))
但事實證明怪異:
任何幫助,非常感謝!
什麼是x軸?變體是否增加了抖動? – G5W
你到目前爲止嘗試過什麼?它通常皺起眉頭張貼一張圖的圖片,並說「請爲我做這件事」。你應該看看[製作一個代表例子](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – tbradley
我曾嘗試使用ggplot2並使用抖動,但它並不是我想要的樣子。 – TYL