用R语言和这个数据绘制柱状图,不用ggplot2
时间: 2024-12-22 16:26:21 浏览: 8
好的,你可以使用基础的 `barplot` 函数来绘制柱状图。以下是具体的代码示例:
```r
# 数据准备
soil_types <- c("Sand Loam and Leaf Mold (3:1)", "Common Soil")
root_system_vitality_increase <- c(35, 0)
plant_height_increase <- c(12, 0)
# 绘制根系活力增加的柱状图
barplot(root_system_vitality_increase,
names.arg = soil_types,
main = "Percentage Increase in Root System Vitality",
xlab = "Soil Type",
ylab = "Percentage Increase (%)",
col = "blue")
# 添加植株高度增加的柱状图
barplot(plant_height_increase,
names.arg = soil_types,
main = "Average Increase in Plant Height",
xlab = "Soil Type",
ylab = "Increase in Height (cm)",
col = "green")
```
这段代码会生成两个独立的柱状图,分别展示不同土壤类型的根系活力增加百分比和植株高度增加情况。希望这对你有帮助!
阅读全文