I am currently creating some histograms in R using ggplot that have many bins and a large data set (850 000 elements).
As a result the vertical lines of each bin are filling in the area under the histogram with the line colour due to there close proximity. I would ideally like this to be clear so I can plot another histogram on the same plot.
Ideally, I would like a histogram with the bin lines hidden where they overlap with another bin so It looks similar to a line plot.
Below is the ggplot code I'm using:
ggplot(df, aes(x=eev)) +
geom_histogram(binwidth = 18,color="black") +
xlim(0,10000) +
scale_y_log10(name="Log of Counts", labels = scales::comma) +
xlab("Incident Energy in eV")
I can't really fiddle around with the bin size too much because I need the definition from the naarrow bins.
I've had a look through the ggplot documentation but can't find what I'm after.
Cheers
Edit: Following MrFlicks advice I've made some reproducible code
a<-runif(10000, 0, 10)
b<-seq(0,9.999, by = 1/1000)
var<-data.frame(a,b)
ggplot(var, aes(x=a)) +
geom_histogram(binwidth = 0.3, col = "black", fill = "#ffffff00")
This gives the following output Histogram with bin lines
However I need the final histogram to look like this
Histogram without overlapping bin lines
I can't use geom_freqpoly
as the data needs to be presented as a histogram.
Here is the current histogram for some of the real data
Cheers again.
Also, apologies this is the first time posting on stack overflow if my post layout is off etc.