Removing white space below bars

3,543 views
Skip to first unread message

Kevin Stierhoff

unread,
Mar 26, 2012, 11:28:49 AM3/26/12
to ggplot2
I know there's a simple solution to this, but I'm not searching the 
correct terms. I want to remove the white space between the bottom of 
the bars and the x-axis. Which opt() am I missing?

p1 + geom_bar(position = dodge, stat = 
"identity",aes(fill=factor(year))) + labs(fill="Year") +
     scale_fill_manual(values=c("grey10","grey30","grey50","grey70")) +
     geom_errorbar(limits, position = dodge, colour = "black",width=0.3) +
     scale_x_discrete('Depth stratum (m)') + scale_y_continuous('Mean 
density (white abalone / ha)') +
     theme_bw() + opts(legend.position=c(0.85,0.7),legend.text = 
theme_text(size=12),
     legend.title = theme_blank(),axis.title.x = theme_text(face="bold", 
size=12), axis.text.x  = theme_text(size=12),
     axis.title.y = theme_text(face="bold", size=12, angle=90), 
axis.text.y  = theme_text(size=12))

 

David Kahle

unread,
Mar 26, 2012, 11:30:54 AM3/26/12
to kevin.s...@noaa.gov, ggplot2
qplot(1:10, geom = 'bar') + scale_y_continuous(expand = c(0,0))

?

HTH,
david.

<fefieacf.png> 

--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

Kevin Stierhoff

unread,
Mar 26, 2012, 11:43:16 AM3/26/12
to David Kahle, ggplot2
Yes, David, that was it. I had to set the scale_y_continuous(limits = c(0,35)) to keep from lopping-off the error bar, but that solved my problem. Many thanks!
--
Kevin Stierhoff, PhD
Research Fisheries Biologist
NOAA Fisheries Service - Southwest Fisheries Science Center
8604 La Jolla Shores Dr. B-115
La Jolla, CA 92037
TE: (858) 546-7180 FX: (858) 546-5656

Kevin.S...@noaa.gov
http://sites.google.com/site/kevinstierhoff/home
http://swfsc.noaa.gov/
Reply all
Reply to author
Forward
0 new messages