R中的柱状图图例和X轴标签调整。

问题描述 投票:-1回答:1

我想用条形图来画这个图。enter image description here

我使用的代码是


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)

但我得到这个 enter image description here

FalikData是 enter image description here

type    plant width

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

r plot bar-chart data-visualization
1个回答
0
投票

我想你要找的是这个

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"))
© www.soinside.com 2019 - 2024. All rights reserved.