5
我在this数据中创建了“DISTANCE”在变量“STATE”中的比例分布的条形图。我的代码如下:R:格点在pdf中的传奇故事
library(R.utils)
df = loadObject("bchart.bin")
df.prop = as.data.frame(prop.table(table(df$STATE, df$DISTANCE),1)) #Creating proportions data
names(df.prop) = c('State','Distance','Proportion')
library(lattice)
pdf(file="bchart.pdf", width=10, height=10, pointsize=10)
barchart(State ~ Proportion, groups=Distance, data=df.prop, stack=T, horizontal=T, auto.key=list(columns=5, space="top"), par.settings = list(superpose.polygon = list(col = rev(gray.colors(5)))))
dev.off()
pdf文件是here。为什么当'>'打印正确时,图例将'≤'打印为'...'?这只发生在pdf或eps上。如果我使用PNG,output is fine。
这可能是一个编码问题。非'latin1'语言每天都会处理这个问题,而且这不是很好。 – 2012-07-13 10:18:49
完美!非常感谢,谢谢。 – user702432 2012-07-13 14:32:23