,我有以下的輸入表:繪製r中使用barplot 3個變量
city district shoptype value
A A1 retail 1000
A A1 restaurant 200
A A2 retail 5000
A A2 restaurant 600
B A1 retail 2000
B A1 restaurant 3000
B A2 retail 400
B A2 restaurant 500
我想繪製該使用barplot:
X axis: City and District, Y axis: shoptype, size of bar: value
我可以知道我怎麼能做到這一點?我還沒有能夠使用3個變量繪製我想要的結果...
請幫助! 謝謝!
I've created an example of my desired image
添加由早期Akrun創建數據幀代碼(感謝Akrun)
df1 <- structure(list(city = c("A", "A", "A", "A", "B", "B", "B", "B"),
district = c("A1", "A1", "A2", "A2", "A1", "A1", "A2", "A2"),
shoptype = c("retail", "restaurant", "retail", "restaurant", "retail", "restaurant", "retail", "restaurant"),
value = c(1000L, 200L, 5000L, 600L, 2000L, 3000L, 400L, 500L)),
.Names = c("city", "district", "shoptype", "value"),
class = "data.frame", row.names = c(NA, -8L))
你是什麼意思 「:shoptype Y軸」 是什麼意思?你的意思是「酒吧的大小」 - 你是指寬度還是面積?你能提供你想要的輸出的圖像(使用另一個程序或字面上的繪畫和拍照),以便我們可以更好地瞭解你的想法? – Hugh
我同意@Hugh的描述不夠清楚 – akrun