[R] small plot inside a big plot
Uwe Ligges
ligges at statistik.uni-dortmund.de
Sat Jun 7 12:22:20 CEST 2003
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
You 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
More information about the R-help
mailing list