前言
记录一些R语言中的可视化方法(随时更新)
0.图像设置
参考https://blog.csdn.net/weixin_42120275/article/details/117140912
具体例子:
par(mar=c(5,9,4,2))
之后在下面画图就可以了
1.柱状图
barplot函数
具体例子:
barplot(sorted$Count,names.arg = sorted$Host,horiz=T, las=2, main='All visits to Amazon')
1.las参数
坐标刻度标签的方向。0表示总是平行于坐标轴,1表示总是水平,2表示总是垂直于坐标轴。可以在plot,axis等函数中使用。
2.yaxt,xaxt参数
是否显示相应坐标轴的标度。yaxt="n"表示不显示y轴的刻度。
2.饼状图
pie函数
具体例子:
pie(sorted$Count[1:11],sorted$Host[1:11], main='Pie Chart of All Hosts')
第一个参数是数值,第二个是对应的名称