
Last chance! 50% off unlimited learning
Sale ends in
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)
lower x-coordinate of the sub-panel relative to the current plot.
lower y-coordinate of the sub-panel relative to the current plot.
upper x-coordinate of the sub-panel relative to the current plot.
upper y-coordinate of the sub-panel relative to the current plot.
graphical parameters to user with par
.
# NOT RUN {
# 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'))
# }
Run the code above in your browser using DataLab