由于出图需求,需要使用一页多图的方式出图。对照着《GGPLOT2:数据分析与图形艺术》书上的程序方法测试了下,不管的计算方式还是GRID.LAYOUT方式,两种排版方式都出现了同样的错误。代码是
library(RODBC)
library(ggplot2)
library(reshape2)
library(grid)
ot<-odbcConnect("ot",uid=,pwd=)
us<-odbcConnect("us",uid=,pwd=)
otcy1<-sqlFetch(ot,"day_cy1")
a1<-qplot(统计日期,访客数,data=otcy1,geom=c("line","point"),colour=shopname)
b1<-qplot(统计日期,PC端访客数,data=otcy1,geom=c("line","point"),colour=shopname)
b2<-qplot(统计日期,无线端访客数,data=otcy1,geom=c("line","point"),colour=shopname)
c1<-qplot(统计日期,pcuvpersent,data=otcy1,geom=c("line","point"),colour=shopname)
c2<-qplot(统计日期,wxuvpersent,data=otcy1,geom=c("line","point"),colour=shopname)
vpa1=viewport(width=1,height=0.3,x=0.5,y=0.75)
vpb1=viewport(width=0.5,height=0.3,x=0.25,y=0.45)
vpb2=viewport(width=0.5,height=0.3,x=0.75,y=0.45)
vpc1=viewport(width=0.5,height=0.3,x=0.25,y=0.15)
vpc2=viewport(width=0.5,height=0.3,x=0.75,y=0.15)
pdf("test.pdf",width=8,height=9)
print(a1,vp=vpa1)
print(b1,vp=vpb1)
print(b2,vp=vpb2)
print(c1,vp=vpc1)
print(c2,vp=vpc2)
dev.off()
close(ot)
close(us)
都是在出图语句里开始出现
> print(a1,vp=vpa1)
There were 50 or more warnings (use warnings() to see the first 50)
然后WARNINGS的错误是:
> warnings(0)
警告信息:
1: In grid.Call(L_textBounds, as.graphicsAnnot(x$label), ... :
'mbcsToSbcs'里转换'缁熻℃棩鏈'出错:<e7>代替了dot
0
2: In grid.Call(L_textBounds, as.graphicsAnnot(x$label), ... :
'mbcsToSbcs'里转换'缁熻℃棩鏈'出错:<bb>代替了dot
0
3: In grid.Call(L_textBounds, as.graphicsAnnot(x$label), ... :
'mbcsToSbcs'里转换'缁熻℃棩鏈'出错:<9f>代替了dot
源数据来自ODBC的数据库,有字段参数名是中文,是不是R不支持中文的参数呢?但是直接的QPLOT是可以出图的。还麻烦大神们帮忙看一下了。谢谢。