0

I have a long formatted data-frame where I plotted histograms for each person's data using facet_wrap(). But I would like to remove a histogram for a person numbered 106. How can I do this in facet_wrap() function without needing to go back and subset my data-frame in ggplot() function.

Here's my code:

h1 <- ggplot(gnT.Data, aes(rt)) + 
  geom_histogram(aes(y = ..density.., fill = ..count..), bins = 100) +
  geom_density(color="red") + 
  scale_fill_gradient(low= "#007BFF", high = "#89EBFF")
h2 <- h1 + xlab("Response time (milli seconds)") + 
  ggtitle("Histogram of Response Time") +
  theme(plot.title = element_text(hjust = 0.5))
h3 <- h2 + facet_wrap(~subnum, scales = "free_y")
plot(h3)

Output: Histogram of Response Time

Richard Telford
  • 9,558
  • 6
  • 38
  • 51

0 Answers0