original graph to be replicated
the attempt at replication
I'm a beginner doing some extra credit for a lab by making graphs in R instead of the software we were given to automatically generate them. The first graph was made by that software, which is what I'm trying to recreate. It seems I'm heading in the right direction since the shape of the curve is right, but the data doesn't line up with the x and y axes correctly.
I'm pretty sure a log function is involved because that's how I got the right shape, but taking the log of the x axis data and/or scaling the x axis with log10 hasn't given me the right results. This is what I have for the graph I've been working on (it seems like the closest I've gotten to replication):
Interpellet <- ggplot(Teach_Back_1_FED3, aes(x=minutes)) +
geom_histogram(aes(y = ..density..), fill='blue') +
geom_density() +
scale_x_log10() +
labs(x='Minutes Between Pellets', y='Density Estimation', title='Interpellet Intervals')
Note: I'm using the same csv for both so it's the same data.