Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In R ggplot, is there a way to create histograms with no filling colors and vertical borders between bars? [duplicate]

Tags:

r

ggplot2

Like the histogram shown below:

plot
(source: cern.ch)

like image 574
xiaoxiao87 Avatar asked Apr 29 '15 21:04

xiaoxiao87


People also ask

Can you build a histogram using ggplot2?

You can also make histograms by using ggplot2 , “a plotting system for R, based on the grammar of graphics” that was created by Hadley Wickham. This post will focus on making a Histogram With ggplot2.

What does bins do in ggplot2?

To construct a histogram, the data is split into intervals called bins. The intervals may or may not be equal sized. For each bin, the number of data points that fall into it are counted (frequency). The Y axis of the histogram represents the frequency and the X axis represents the variable.


1 Answers

Maybe with geom_step

library('ggplot2')

set.seed(1)
x <- unlist(Map(rpois, 20, 4:1 * 5))
qplot(seq_along(x), x, geom = 'step')

enter image description here

like image 58
rawr Avatar answered Sep 22 '22 19:09

rawr