I'm having problems with this example, it is posted with reproduceable code
below, both with the normal 0-6 scale and the desired 3-6 scale (with bars
removed). How can I get the graph to have the desired 3-6 scale without
removing the bars. Thanks!

#Data
mean=as.numeric(c(5.117647059,5,4.947368421,4.85,4.6875,4.545454545,4.473684211,4.470588235,4.428571429,4.083333333,3.421052632,3.235294118))
data=as.data.frame(cbind(mean,c("Achievement","Achievement","Achievement","Impact","Achievement","Achievement","Achievement","Impact","Impact","Impact","Impact","Impact"),c("Update
knowledge and skills","Meet requirements for current position","Discover new
job opportunities","Discover new job opportunities","Transition to a new
job","Meet requirements for certificaiton","Personal enrichment","Update
knowledge and skills","Meet requirements for current position","Meet
requirements for certificaiton","Personal enrichment","Transition to a new
job")))
colnames(data)=c("mean","variable","Q")
data[,1]=mean

#Plot
p=qplot(data=data,data$Q,data$mean,fill=data$variable,geom="bar",stat="identity",position="dodge",binwidth=2,ylab=NULL,xlab=NULL,width=.75)
 

#With 0-6 Scale
p + scale_x_discrete(expand=c(0,0)) + 
scale_y_continuous(limits=c(0,7),breaks=seq(from=0,to=6,by=.5),expand=c(0,0))
+
coord_flip() +
scale_fill_manual(values=c("darkmagenta","lightgoldenrod1")) +
                opts(
                        panel.background = theme_rect(colour = NA),
                        panel.background = theme_blank(),
                        panel.grid.minor = theme_blank(),
                        axis.title.x= theme_blank(),
                        axis.title.y= theme_blank(),
                        axis.text.y=theme_text(size=12,hjust=1),
                        legend.text=theme_text(size=14)
                        ) 

#With 3-6 Scale (Bars Deleted)
p + scale_x_discrete(expand=c(0,0)) + 
scale_y_continuous(limits=c(3,6),breaks=seq(from=3,to=6,by=.5),expand=c(0,0))
+
coord_flip() +
scale_fill_manual(values=c("darkmagenta","lightgoldenrod1")) +
                opts(
                        panel.background = theme_rect(colour = NA),
                        panel.background = theme_blank(),
                        panel.grid.minor = theme_blank(),
                        axis.title.x= theme_blank(),
                        axis.title.y= theme_blank(),
                        axis.text.y=theme_text(size=12,hjust=1),
                        legend.text=theme_text(size=14)
                        ) 

There is probably an option I'm missing or maybe my data should be set up
differently, any help would be much appreciated!!
-- 
View this message in context: 
http://r.789695.n4.nabble.com/ggplot-qplot-bar-removing-bars-when-truncating-scale-tp2272735p2272735.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to