我已经找到了这个问题的答案,但没有找到答案--我在画完之后使用ggplot2绘制了一系列密度,我需要获得x和y的比例,这样我就可以在左上角进行注释了--这是我的代码:
gg= qplot(ExpRef,geom='density',color=IOL,fill=IOL,alpha=0.8,data=tmp2,
main=mtitle,xlab ="Expected Refraction",cex.axis=3.0,font.axis = 2) #bold and cesx = multiplier);
ggp = gg + geom_vline(data=data.frame(x=0,y=0),xintercept=means, lwd= 2,color=I("red")) ;
ggp = gg + geom_vline(data=data.frame(x=0,y=0),xintercept=PlanRef, lwd= 2,color=I("green")) ;
ggp = ggp + annotate("text",x=PlanRef, y = 1, label=paste('Planned Refraction'),angle=90,size=7.0,colour='black', hjust = 0, vjust = 0)
ggp = ggp + annotate("text",x=SRKTRef, y = 0,label=paste('SRKT IOL-->'),angle=90,size=6.0,colour='yellow', hjust = 0, vjust = 0);发布于 2013-05-13 16:01:15
对于绘图区域边框的注释,可以使用-Inf (左/底)或+Inf (右/顶):
qplot(1:10, rnorm(10)) +
annotate("text", x=Inf, y=-Inf,
label="bottom-right", vjust=-0.5, hjust=1)https://stackoverflow.com/questions/16525299
复制相似问题