rect | R Documentation |
Add single or multiple rectangles to the plotting region. See rect
for more details.
rect(object, ...)
object |
gsplot object |
... |
Further graphical parameters may also be supplied as arguments. See 'Details'. |
Additional graphical parameter inputs:
xleft
vector or scalar indicating left positions on the x-axis
xright
vector or scalar indicating right positions on the x-axis
ybottom
vector or scalar indicating bottom positions on the y-axis
ytop
vector or scalar indicating top positions on the y-axis
density
density of shading lines (lines per inch), NULL means no shading, NA suppresses shading and allows color fill
angle
angle of shading lines (degrees)
col
shade or fill color(s), NA means no fill (transparent)
border
color of border, NA means no border, TRUE indicates the same color as shading lines
lty
line type for borders and shading
lwd
line width for borders and shading
legend.name
name that appears in the legend, see legend
for more legend parameters
rect
gs <- gsplot() %>%
points(x=c(1:5, 3.5), y=c(1:5, 6), legend.name="Stuff") %>%
lines(x=2:6, y=2:6, ylim=c(0,10)) %>%
axis(side=c(1,2),labels=TRUE) %>%
legend("topright") %>%
rect(xleft=3.4, xright=3.6, ybottom=5,
ytop=7, density=NULL, border='purple',
lty=2, lwd=3)
gs
gs <- gsplot() %>%
lines(x=10:20, y=c(10:15, 25, 17:20),
xlim=c(0,30), ylim=c(0,30), col='darkgreen',
legend.name="Some data") %>%
rect(xleft=15, xright=17, ybottom=21, ytop=27,
density=10, angle=130, col='darkblue') %>%
legend()
gs
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.