pp=seq(0.1,1,by=0.1)
sx=array(0,10,1)
for(i in 1:10)
{
sx=sum(x[1:i])
}
DataCumPer=data.frame(CUM=sx,PP=pp)#一定要转换成数据框
p=ggplot(DataCumPer,aes(CUM,PP))
p=p+geom_line(linetype="dotted",size=I(0.8))#设置线型和粗细
p=p+xlab("累积和")#横轴标签
p=p+geom_point(size=I(3),shape=I(18))#设置形状和大小
p=p+ylab("百分位点")#纵轴标签
p=p+opts(axis.title.x= theme_text(size = 15,color="red"))#设置字体和颜色
p=p+opts(axis.title.y= theme_text(size = 15))
p=p+scale_y_continuous(formatter = "percent",breaks =pp)#设置格式为百分比,10%为一档
p=p+opts(title="帕累托图",plot.title = theme_text(size = 20,face="bold",vjust=1.5))#设置图的标题
p#显示结果


雷达卡








京公网安备 11010802022788号







