学习小组Day4笔记-李芳

R学习(带数字的分枝为已学内容)

R学习.png

复制R学习中看到的图表代码,在RStudio上复现柱形图

# Create the input vectors.
colors <- c("green","orange","brown")
months <- c("Mar","Apr","May","Jun","Jul")
regions <- c("East","West","North")
 
# Create the matrix of the values.
Values <- matrix(c(2,9,3,11,9,4,8,7,3,12,5,2,8,10,11),nrow = 3,ncol = 5,byrow = TRUE)

# Create the bar chart.
barplot(Values,main = "total revenue",names.arg = months,xlab = "month",ylab = "revenue", col = colors)

# Add the legend to the chart.
legend("topleft", regions, cex = 1.1, fill = colors)

代码出处:
https://www.w3cschool.cn/r/r_bar_charts.html

20210203-01_total-revenue.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容