Reputation: 2528
I am plotting a density function with the ggplot2
package. I noticed that the first and second vertical line are not perfectly rectangular, although as far as I understand they should be, or? I also found this to be the case, when plotting a distribution of the binomial distribution that the the steps are not really rectangular.
library(ggplot2)
p_uniform_density <- ggplot(data.frame(x = c(-2, 17.5)), aes(x)) +
stat_function(fun = dunif, args = list(min = 0, max = 15), size=1.2 ) +
theme_bw() +
labs(y = "f(X)", x = "X") +
theme(text = element_text(size=20) , panel.grid.major = element_line(size = 0.2, linetype = 'solid', colour = "grey"),
panel.grid.minor = element_line(size = 0.1, linetype = 'solid', colour = "grey")) +
scale_x_continuous( breaks = c(-2:17.5))
Upvotes: 1
Views: 190