subplot: Insert a sub-panel into plot

View source: R/subplot.R

subplotR Documentation

Insert a sub-panel into plot

Description

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')).

Usage

subplot(xleft = NA, ybottom, xright, ytop)

Arguments

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.

Value

graphical parameters to user with par.

Author(s)

Danail Obreschkow

Examples

# 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'))


obreschkow/cooltools documentation built on Nov. 16, 2024, 2:46 a.m.