A response to @lebebr01: http://stackoverflow.com/questions/tagged/r
simdata <- data.frame(x = runif(2400, min = .032, max = .210),
y = c(rnorm(2000, mean = 0, sd = .1),
rnorm(400, mean = 1, sd = .25)),
group = c(sample(1:2, 1600, replace = TRUE),
rep(1, 400),
rep(2, 400)),
facet = rep(1:3, each = 800))
simdata$x_rd <- round(simdata$x, 3)
library(dplyr)
##
## Attaching package: 'dplyr'
##
## The following object is masked from 'package:stats':
##
## filter
##
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
simdata_agg <- simdata %>%
group_by(x_rd, group, facet) %>%
summarise(y = mean(y))
library(ggplot2)
p <- ggplot(simdata_agg, aes(x = x_rd, y = y, shape = factor(group))) +
theme_bw()
p + geom_point(size = 3) + facet_grid(. ~ facet) +
scale_x_continuous("x", limits = c(0, .25),
breaks = seq(.00, .25, .05),
labels = function(x) gsub("^0+", "", sprintf("%.2f", x)))