全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1765 1
2020-05-07
求助:R语言循环绘图,部分数据刻度显示正常,其他一部分刻度显示不正常,左侧纵坐标显示为TRUE,并且图片的轴标签显示不全。求高人指点代码如下:
a<- subset(constituent)[,11:42]
b=names(a)
c<-subset(constituent,select=location)
d<-unique(c)


for (i in 1:nrow(d)){
  constituent_group=subset(constituent,location==d$location)
  pdf(d[i,],width=20,height=22)
  layout(matrix(c(1,2,3,4),ncol=1,byrow=T))
  par(mar=c(8,10,8,10),mgp=c(3,1,0),las=1)
  showtext_begin()
  for (j in 1:ncol(a)){
    constituent_group1=subset(constituent_group,select=c(location,date,j+10,PM2.5))
    validl<-!is.na(constituent_group1[,3])
    validr<-!is.na(constituent_group1$PM2.5)
    if (sum(validl)<=0 )
      next
    twoord.plot(lx = constituent_group1$date[validl],
                ly = as.numeric(constituent_group1[,3][validl]),
                rx = constituent_group1$date,
                ry = constituent_group1$PM2.5,
                main = constituent_group1$location[1],
                xlab = "Time",
                ylab = names(constituent_group1)[3],
                rylab = "PM2.5",
                type = c("point","line"),
                lytickpos= max(as.numeric(constituent_group1[,3])),
                lcol= "steelblue", rcol = "red",lpch=20)
  }
  showtext_end()
  dev.off()
}

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2020-5-7 17:32:21
这是显示不正常的图
附件列表
微信截图_20200507171827.png

原图尺寸 102.81 KB

微信截图_20200507171827.png

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群