R: Lattice在pdf中破坏了图例

5

我正在创建一个柱状图,展示“DISTANCE”在变量“STATE”上的分布比例,使用这个数据。我的代码如下:

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文件在这里。为什么图例打印“≤”时会显示为“...”,而“>”则正常?这只在pdf或eps中发生。如果使用png,则输出正常

1个回答

2

当使用cairo PDF后端时,它应该可以正常工作,例如:

cairo_pdf(file="bchart.pdf", width=10, height=10, pointsize=10)

虽然我没有核实,但这可能与PDF编码有关,请参见Paul Murrell的Including fancy glyphs in R Graphics PDF output


这可能是一个编码问题。非latin1语言每天都会遇到这个问题,而且不太好处理。 - Roman Luštrik

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接