Dear R-helpers, i want to draw a small plot (histogram) within a larger plot (simple scatterplot), so that the axes of the bigger plot remain intact. I know how to use layout() and par(mfrow...) and such, but I want the smaller graph to be *inside* the bigger plot. Is this possible? thanks, Remko
For a histogram, you might use `add = TRUE' in the call to hist(). -roger Remko Duursma wrote:> Dear R-helpers, > > i want to draw a small plot (histogram) within a larger plot (simple scatterplot), so that the axes of the bigger plot remain intact. > > I know how to use layout() and par(mfrow...) and such, but I want the smaller graph to be *inside* the bigger plot. Is this possible? > > thanks, > > Remko > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >
Actually, that will not work. I want the histogram to be much smaller than the plot to which i want to add it, I don't want to overlay it, instead i want to have a small box in the whitespace of the scatterplot containing the histogram. Remko ^'~,_,~'^'~,_,~'^'~,_,~'^'~,_,~'^'~,_,~'^'~,_,~' Remko Duursma, Ph.D. student Forest Biometrics Lab / Idaho Stable Isotope Lab University of Idaho, Moscow, ID, U.S.A. --------- Original Message --------- DATE: Fri, 06 Jun 2003 14:59:12 From: "Roger D. Peng" <rpeng at stat.ucla.edu> To: den.duurs at lycos.com Cc: rhelp <r-help at r-project.org>>For a histogram, you might use `add = TRUE' in the call to hist(). > >-roger > >Remko Duursma wrote: > >> Dear R-helpers, >> >> i want to draw a small plot (histogram) within a larger plot (simple scatterplot), so that the axes of the bigger plot remain intact. >> >> I know how to use layout() and par(mfrow...) and such, but I want the smaller graph to be *inside* the bigger plot. Is this possible? >> >> thanks, >> >> Remko >> >> ______________________________________________ >> R-help at stat.math.ethz.ch mailing list >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help >> >> > >
Remko Duursma wrote:> > Dear R-helpers, > > i want to draw a small plot (histogram) within a larger plot (simple scatterplot), so that the axes of the bigger plot remain intact. > > I know how to use layout() and par(mfrow...) and such, but I want the smaller graph to be *inside* the bigger plot. Is this possible? > > thanks, > > RemkoYou might want to play with the argument "plt" in par(), see ?par for details. Example: plot(1:10) par("plt" = c(0.6, 0.9, 0.3, 0.5)) par(new = TRUE) hist(rnorm(10)) layout() might also help, if your "small" plot is somewhere within a grid: plot(1:10) layout(matrix(c(0,0,0,1), ncol=2)) par(new = TRUE, oma = par("mar")) hist(rnorm(10)) Or look into package "grid" for more sophisticated but (from my point of view) less easy solutions. Uwe Ligges