subplot | R Documentation |
Insert a sub-panel into an existing plotting area. To open a subplot, call par(subplot(...))
, to close it, you must call par(subplot('off'))
.
subplot(xleft = NA, ybottom, xright, ytop)
xleft |
lower x-coordinate of the sub-panel relative to the current plot. |
ybottom |
lower y-coordinate of the sub-panel relative to the current plot. |
xright |
upper x-coordinate of the sub-panel relative to the current plot. |
ytop |
upper y-coordinate of the sub-panel relative to the current plot. |
graphical parameters to user with par
.
Danail Obreschkow
# main plot
f = function(x) x*sin(1/(x+.Machine$double.eps))
curve(f,0,1,n=1000,ylim=c(-1,1),xlab='',ylab='',xaxs='i',yaxs='i')
rect(0.02,-0.1,0.1,0.1,border='blue',col=transparent('blue',0.2))
# subplot
par(subplot(0.55,-0.8,0.93,0))
curve(f,0.02,0.1,n=500,ylim=c(-0.1,0.1),xlab='',ylab='',xaxs='i',yaxs='i')
rect(0.02,-0.1,0.1,0.1,border=NA,col= transparent('blue',0.2))
par(subplot('off'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.