Skip to content

Grouped overlapping histograms #18

Discussion options

You must be logged in to vote

A solution in BoutrosLab.plotting.general is

set.seed(13);
# Sample size
N <- 1000;
# Generate some data in two groups
data <- rbind.data.frame(
  cbind.data.frame(value = rnorm(N), group = 1),
  cbind.data.frame(value = rnorm(N, mean = 1.5), group = 2)
  );
null.sim <- rnorm(N);
alt.sim <- rnorm(N, mean = 2);
group1.col <- '#E69F00';
group2.col <- '#56B4E9';
histogram1 <- create.histogram(
  x = data$value[data$group == 2],
  type = 'count',
  ylab.label = 'Count',
  xlab.label = 'value',
  col = scales::alpha(group1.col, alpha = 0.7),
  xlimits = c(-5, 6),
  # Add key to upper left corner
  key = list(
    corner = c(0,.95),
    rect = list(
      col = c(group1.col, group2.col)
      )…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by stefaneng
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant