悬赏 100 个论坛币 未解决
我用GGPLOT2包绘图,数据来自ODBC的MS SQL数据库。最后用PDF和PRINT命令出图,都用的日期字段做X轴,由于数据库原因,里面的日期字段有2个,一个是文本储存的,一个是数字储存的。最初的时候X轴用的是文本型的那个,程序可以出图。
后来,我看X轴输出很杂乱,就改用数字型的日期做X轴了,这个字段用CLASS看是 DATE属性。
结果,在PDF()前后查看图像,完全不同。
在PDF()系列命令前,RSTUDIO的PLOTS里可以出图,但是放在PDF之后就出现了:
> l3
There were 50 or more warnings (use warnings() to see the first 50)
部分代码如下:
#l2
pdf("g:/zzzzworkrout/test.pdf",width=7,height=12)
#1-12-12 grid mark
vp1<-viewport(width=1,height=0.31,x=0.5,y=0.75)
vp2<-viewport(width=0.5,height=0.31,x=0.25,y=0.45)
vp3<-viewport(width=0.5,height=0.31,x=0.75,y=0.45)
vp4<-viewport(width=0.5,height=0.31,x=0.26,y=0.15)
vp5<-viewport(width=0.5,height=0.31,x=0.76,y=0.15)
l3
vp6<-viewport(width=0.5,height=0.31,x=0.25,y=0.75)
vp7<-viewport(width=0.5,height=0.31,x=0.75,y=0.75)
vp8<-viewport(width=0.5,height=0.31,x=0.25,y=0.45)
vp9<-viewport(width=0.5,height=0.31,x=0.75,y=0.45)
#print-----------------------------------------------------------
print(l1,vp=vp1)
print(l2,vp=vp2)
print(l3,vp=vp3)
print(l4,vp=vp4)
print(l5,vp=vp5)
我是用一页多图的方式出图
上面的L2处就是能在RSTUDIO看到的,L3处紧跟着就是
ERROR了,然后用WARNINGS()调出来,看到的是
> warnings()
警告信息:
1: In grid.Call(L_textBounds, as.graphicsAnnot(x$label),  ... : 'mbcsToSbcs'里转换'9鏈?28'出错:<e6>代替了dot
2: In grid.Call(L_textBounds, as.graphicsAnnot(x$label),  ... : 'mbcsToSbcs'里转换'9鏈?28'出错:<9c>代替了dot
3: In grid.Call(L_textBounds, as.graphicsAnnot(x$label),  ... : 'mbcsToSbcs'里转换'9鏈?28'出错:<88>代替了dot
4: In grid.Call(L_textBounds, as.graphicsAnnot(x$label),  ... : 'mbcsToSbcs'里转换'10鏈?05'出错:<e6>代替了dot
5: In grid.Call(L_textBounds, as.graphicsAnnot(x$label),  ... : 'mbcsToSbcs'里转换'10鏈?05'出错:<9c>代替了dot
6: In grid.Call(L_textBounds, as.graphicsAnnot(x$label),  ... : 'mbcsToSbcs'里转换'10鏈?05'出错:<88>代替了dot
7: In grid.Call(L_textBounds, as.graphicsAnnot(x$label),  ... : 'mbcsToSbcs'里转换'10鏈?12'出错:<e6>代替了dot
这是PDF的问题,还是GRID的问题呢,或者其他的什么问题呢