第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何使用ggplot2上的標(biāo)識(shí)控制堆積條形圖的順序

如何使用ggplot2上的標(biāo)識(shí)控制堆積條形圖的順序

米脂 2019-12-03 10:13:55
使用這個(gè)假人 data.framets <- data.frame(x=1:3, y=c("blue", "white", "white"), z=c("one", "one", "two"))我嘗試在頂部繪制“藍(lán)色”類(lèi)別。ggplot(ts, aes(z, x, fill=factor(y, levels=c("blue","white" )))) + geom_bar(stat = "identity")在上面給我“白色”。和ggplot(ts, aes(z, x, fill=factor(y, levels=c("white", "blue")))) + geom_bar(stat = "identity")反轉(zhuǎn)顏色,但頂部仍給我“白色”。我怎樣才能在頂部獲得“藍(lán)色”?
查看完整描述

3 回答

?
幕布斯6054654

TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超7個(gè)贊

group在ggplot()通話中使用美感。這樣可以確保所有層以相同的方式堆疊。


series <- data.frame(

  time = c(rep(1, 4),rep(2, 4), rep(3, 4), rep(4, 4)),

  type = rep(c('a', 'b', 'c', 'd'), 4),

  value = rpois(16, 10)

)


ggplot(series, aes(time, value, group = type)) +

  geom_col(aes(fill = type)) +

  geom_text(aes(label = type), position = "stack")


查看完整回答
反對(duì) 回復(fù) 2019-12-03
  • 3 回答
  • 0 關(guān)注
  • 4593 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)