Answer by Joseph Crispell for How can I plot two histograms together in R?
So many great answers but since I've just written a function (plotMultipleHistograms() in 'basicPlotteR' package) function to do this, I thought I would add another answer.The advantage of this...
View ArticleAnswer by Stat-R for How can I plot two histograms together in R?
Already beautiful answers are there, but I thought of adding this. Looks good to me.(Copied random numbers from @Dirk). library(scales) is...
View ArticleAnswer by András Aszódi for How can I plot two histograms together in R?
@Dirk Eddelbuettel: The basic idea is excellent but the code as shown can be improved. [Takes long to explain, hence a separate answer and not a comment.]The hist() function by default draws plots, so...
View ArticleAnswer by Mateo Sanchez for How can I plot two histograms together in R?
Plotly's R API might be useful for you. The graph below is here.library(plotly)#add username and keyp <- plotly(username="Username", key="API_KEY")#generate datax0 = rnorm(500)x1 =...
View ArticleAnswer by Dirk is no longer here for How can I plot two histograms together...
Here is an even simpler solution using base graphics and alpha-blending (which does not work on all graphics devices):set.seed(42)p1 <- hist(rnorm(500,4)) # centered at 4p2 <- hist(rnorm(500,6))...
View ArticleAnswer by chrisamiller for How can I plot two histograms together in R?
Here's a function I wrote that uses pseudo-transparency to represent overlapping histogramsplotOverlappingHist <- function(a, b, colors=c("white","gray20","gray50"), breaks=NULL, xlim=NULL,...
View ArticleAnswer by John for How can I plot two histograms together in R?
Here's the version like the ggplot2 one I gave only in base R. I copied some from @nullglob.generate the datacarrots <- rnorm(100000,5,2)cukes <- rnorm(50000,7,2.5)You don't need to put it into a...
View ArticleAnswer by nullglob for How can I plot two histograms together in R?
Here is an example of how you can do it in "classic" R graphics:## generate some random datacarrotLengths <- rnorm(1000,15,5)cucumberLengths <- rnorm(200,20,7)## calculate the histograms - don't...
View ArticleAnswer by John for How can I plot two histograms together in R?
That image you linked to was for density curves, not histograms.If you've been reading on ggplot then maybe the only thing you're missing is combining your two data frames into one long one.So, let's...
View ArticleHow can I plot two histograms together in R?
I am using R and I have two data frames: carrots and cucumbers. Each data frame has a single numeric column that lists the length of all measured carrots (total: 100k carrots) and cucumbers (total: 50k...
View Article
More Pages to Explore .....