1

I would like to create a kind of histogram using geom_bar(). The bars should have no fill and should not have vertical lines in-between the bars, i.e. a histogram which only displays a fringe around the bars (the border of the bars). Do you have any idea?

Thank you very much! Regards Tobi

example code:

df <- data.frame(x=seq(40,62,2), y=c(0,1,3,5,2,7,9,3,5,1,4,0))
library(ggplot2)
ggplot(data=df, aes(x=x, y=y)) + 
  geom_bar(stat="identity",width=2,binwidth=.7,fill=NA,colour='black') + 
  theme_bw()
tokami
  • 35
  • 4
  • You mean something like this? `ggplot(data=df, aes(x=x, y=y)) + geom_bar(stat="identity",width=2,binwidth=.7,fill=NA,colour='black') + theme_bw() + theme(panel.grid.minor=element_blank(), panel.grid.major=element_blank())` – jazzurro Dec 05 '14 at 09:02
  • Thank you for your response. I have a hard time to describe what I am trying to create, but in the end it should look similiar to this graph: [link](http://s8.postimg.org/rofrz4jo5/graph.jpg) @jazzurro – tokami Dec 06 '14 at 07:35
  • @Tobias How about [**this link**](http://www.cookbook-r.com/Graphs/Plotting_distributions_(ggplot2)/)? If you do not mind using density, you will probably get what you want. – jazzurro Dec 06 '14 at 13:28
  • Thanks again. I would prefer to have my own y variable, because the absolute frequency is going to be compared between different plots. – tokami Dec 07 '14 at 04:55

0 Answers0