编辑代码

# 指定数据集
attach(iris)

# 4.1 basic plot
plot(Sepal.Width)  # 散点图

table(Sepal.Width) # 频数统计表
plot(table(Sepal.Width),                   # table统计频数分布
    main = "frequency of sepal width",     # main定义图标题
    xlab = "sepal width",                  # x轴标签
    ylab = "number of items")              # y轴标签

# 4.2 save plot(可选格式:png、pdf、jepg)
dev.copy(device=pdf,file="iris_plot.pdf",width=11,height=9)
dev.off()

# 4.3 othersplot