請問大家R語言中用ggplot做條形圖 ,但是寬度不一樣?該如何解決呢?

時間 2021-06-06 00:30:07

1樓:涼涼的小河海

可以通過position_dodge2中preserve引數進行設定。

library(tidyverse)

df <- data.frame(x = c("CK", rep(c("7h", "18h", "24h", "48h"), each = 3y = sample(1:100, 13group = c("CK", rep(paste0("group", 1:

3), times = 4)))

ggplot(df, aes(x, y, fill = group)) +

geom_bar(stat = "identity", position = position_dodge2(preserve = "total")) +

labs(title = "Setting preserve = \"total\"")

ggplot(df, aes(x, y, fill = group)) +

geom_bar(stat = "identity", position = position_dodge2(preserve = "single")) +

labs(title = "Setting preserve = \"single\"")

可以感受一下兩者的區別。

請問r語言中如何將資料分組

Winmin x rnorm 1000,0,1 x1 sort x,decreasing F for i in 1 10 a x1 1 i 1 100 i 100 print names table a which.max table a zhuobie 我說乙個比較簡單的辦法。將x1轉化為100 ...

R語言中資料篩選的問題?

InfiniteCycle 如果題主對SQL比較熟悉的話,在R中用SQL的語句來進行資料處理會極大地提公升工作效率。假設題主的data.frame的名字叫做 df,可以用以下package和語句進行資料篩選 install.packages sqldf manipulate data with sq...

請問大家的方言中用什麼詞對應普通話中表示進行的 在 呢?

深紅色的迫真神棍 如果是表示正在幹嘛這種的,那我們也是 擱?格?臵 以後就寫成格了,畢竟這個最符合歸入 普通話我在吃飯 方言我正格這兒吃飯誒 w k fan 中原官話洛嵩片洛陽話 曾經的川B 在 去聲 ta 或 a 只有老一輩有時用 dai 據我感知,只能作介詞,也就是不能表進行而 zai 除了調值...