簡體   English   中英

R 和 x 軸 label 調整中的條形圖圖例

[英]barplot legend in R and the x axis label adjustment

我想用酒吧 plot 來畫這個圖在此處輸入圖像描述

我使用了代碼


width <- FalikData$width #This creates a vector of data of the plant stomatal widths
plant <- FalikData$plant #The creates a vector of data of the plant ID numbers


barplot(width, names.arg= plant, 
        col = c("blue", "red"), 
        xlab = "Plant", 
        ylab = expression("Stomatal Opening("~mu~"m)"),
        legend  = (FalikData$type), beside = TRUE)

但我得到了這個在此處輸入圖像描述

FalikData 是在此處輸入圖像描述

type    plant width

control 1 12.109661 15min 1 11.577023 control 2 11.608355 15min 2 10.903394 control 3 9.446475 15min 3 12.093995 control 4 9.697128 15min 4 11.013055 control 5 10.840731 15min 5 11.483029 control 6 10.746736 15min 6 7.221932 control 7 10.605744......

我想你正在尋找這個

barplot(width, names.arg= plant, 
        col = c("blue", "red"), 
        xlab = "Plant", 
        ylab = expression("Stomatal Opening("~mu~"m)"))
legend("topleft",
           fill = c("blue","red"),
           legend = c("control", "15min"))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM