我正在尝试在ggplot中制作一个条形图,我在其中指定要显示哪些标签,通过强制执行其中一些长度为零的字符串,即"".但是,我得到了错误
Error in grid.Call("L_textBounds", as.graphicsAnnot(x$label), x$x, x$y,
: Polygon edge not found (zero-width or zero-height?)
Run Code Online (Sandbox Code Playgroud)
当试图这样做.
以下代码将重现错误.
希望有人能解释为什么我不能像我一样做.
library(ggplot2)
dataset<-matrix(ncol=3,nrow=12)
colnames(dataset)<-c("Score","Action","Bin")
dataset[1:9,1]<-c(1,2,3,-2,7,10,12,3,4)
dataset[1:9,2]<-rep(1,9)
dataset[10:12,1]<-c(-1,-2,-3)
dataset[10:12,2]<-rep(2,3)
dataset[1:12,3]<-as.character(cut(dataset[1:12,1:1],breaks=4))
myDataset<-as.data.frame(dataset)
chosenbreaks<-as.vector(unique(dataset[1:12,3]))
chosenlabels<-as.vector(c(chosenbreaks[1],"","",chosenbreaks[4]))
fullplot<-ggplot(myDataset, aes(Bin, fill=Action))
+ geom_bar(position="stack")
+ opts(axis.text.x = theme_text(angle = 45,size=8))
+ scale_x_discrete("test",breaks=chosenbreaks,labels=chosenlabels)
fullplot
Run Code Online (Sandbox Code Playgroud)
提前致谢,
基督教
小智 5
在Mac上,我也遇到了同样的问题。我必须使用应用程序“字体簿” 删除一些重复的字体。事实是,这些字体的重复项已被禁用(大约一年前它们在NeoOffice中造成了问题)。我不知道为什么这样。(请注意,我删除了我认为这些字体的旧版本-Arial,Times和Palatino就是其中的一些。)也许这为主题提供了一些启示,但我不知道如何。
归档时间: |
|
查看次数: |
17161 次 |
最近记录: |