[R] How to include ifelse condition to adjust QPLOT font size

Gundala Viswanath gundalav at gmail.com
Tue Jun 25 11:09:12 CEST 2013


I have a data which I plot using this code.
Attached is the plot

_BEGIN_
library(ggplot2)
dat.m <- read.delim("http://dpaste.com/1269939/plain/",sep="")
colnames(dat.m) <- c("ensg","mirna_hgc","variable","value")
dat.m.y <- subset(dat.m,dat.m$variable=="y")
qplot(value,data=dat.m.y, geom="bar",  origin=-0.05,
xlim=c(48,101),ylim=c(0,75), facets=variable~.,main="")+
xlab("Value")+
ylab("Frequency")+
theme(legend.position="none")+
stat_bin(aes(label = sprintf("%.01f",
(..count../288)*100)),size=2.5,color="red", vjust=-0.5, angle=0,
geom="text")
__END__

What I wan't to do is to get rid of the barplot labels when the value in red
is 0.0.
How can I go about it?

I tried this but it won't work
stat_bin(aes(label = sprintf("%.01f",
(..count../288)*100)),size=ifelse(dat$m.y>0,2.5,0),color="red", vjust=-0.5,
angle=0, geom="text")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 41397 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130625/8257c29b/attachment-0001.pdf>


More information about the R-help mailing list