subplot: Insert a sub-panel into plot

Description Usage Arguments Value Author(s) Examples

View source: R/subplot.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 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'))

graphx documentation built on Feb. 3, 2022, 5:07 p.m.

Related to subplot in graphx...