1 | gridNorthArrow(..., scale.fact = 1, rot = 0, l.width = 2)
|
... |
|
scale.fact |
|
rot |
|
l.width |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (..., scale.fact = 1, rot = 0, l.width = 2)
{
library(gridExtra)
library(scales)
resizingTextGrob <- function(..., scale.fact = 1) {
grob(tg = textGrob(...), cl = "resizingTextGrob", scale.fact = scale.fact)
}
drawDetails.resizingTextGrob <- function(x, scale.fact, recording = TRUE) {
grid.draw(x$tg)
}
preDrawDetails.resizingTextGrob <- function(x, ...) {
h <- convertHeight(unit(1, "npc"), "mm", valueOnly = TRUE)
fs <- rescale(h, to = c(80, 15), from = c(120, 20)) *
x$scale.fact
pushViewport(viewport(gp = gpar(fontsize = fs)))
}
postDrawDetails.resizingTextGrob <- function(x) popViewport()
pushViewport(viewport(angle = -rot))
grid.polyline(x = c(0.5, 0.5, 0.4, 0.6), y = c(0.1, 0.9,
0.55, 0.55), gp = gpar(lwd = l.width, lineend = "butt",
linejoin = "mitre"))
arrow.n <- resizingTextGrob("N", x = 0.5, y = 0.4, scale.fact = 1)
grid.draw(arrow.n)
popViewport()
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.