I am creating a histogram for which the bars are sufficient to show the horizontal (x) placement, so I would like to avoid drawing extra vertical grid lines.
I understand how to style minor and main grids in opts (), but I canβt understand all my life how to suppress only vertical grid lines.
library(ggplot2) data <- data.frame(x = 1:10, y = c(3,5,2,5,6,2,7,6,5,4)) ggplot(data, aes(x, y)) + geom_bar(stat = 'identity') + opts( panel.grid.major = theme_line(size = 0.5, colour = '#1391FF'), panel.grid.minor = theme_line(colour = NA), panel.background = theme_rect(colour = NA), axis.ticks = theme_segment(colour = NA) )
At this point, it seems to me that I will need to suppress all the grid lines and then return them back using geom_hline (), which seems kind of a pain (itβs also not entirely clear how I can find the tick / major gridline positions to feed into geom_hline ().)
Any thoughts would be appreciated!
r ggplot2
Tarek Apr 20 '10 at 19:47 2010-04-20 19:47
source share