Description Usage Arguments Value Author(s) See Also Examples
Move a vector n elements forward or backward.
1 2 3 4 5 6 7 |
ratio |
Numeric, height : width ratio. If |
width |
The desired width in plot coordinates or proportions. If not specified (NULL), the maximal width fitting in the plot region is returned. |
height |
The desired height in plot coordinates or proportions. If not specified (NULL), the maximal height fitting in the plot region is returned. |
input |
Unit of input width and height, 'coords' (plot coordinates, default), or 'prop' (proportions of plot region). |
... |
Optional arguments: |
A list with 5 elements:
width: width of the element in x-axis coordinates;
height: height of the element in y-axis coordinates;
ratio: provided ratio (for confirmation);
x: two-number vector with x-coordinates of
left and right sides;
y: two-number vector with y-coordinates of
bottom and top sides.
Jacolien van Rij
Other Utility functions:
findAbsMin(),
find_n_neighbors(),
firstLetterCap(),
getArrowPos(),
getDec(),
getRange(),
get_palette(),
group_sort(),
inch2coords(),
isColor(),
list2str(),
move_n_point(),
orderBoxplot(),
se(),
sortGroups()
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 31 32 33 34 | data(img)
emptyPlot(100, c(50, 100), h0=0, v0=0)
# calculate height : width ratio of image:
im.r <- dim(img$image)[1]/dim(img$image)[2]
p <- getRatioCoords(ratio=im.r, width=20)
# inspect p:
p
# No position specified, so centered:
plot_image(img, type='image', add=TRUE,
xrange=p$x, yrange=p$y)
# ... or we could provide a position:
p <- getRatioCoords(ratio=im.r, width=20,
xleft=20, ybottom=60)
plot_image(img, type='image', add=TRUE,
xrange=p$x, yrange=p$y)
# Using proportions of plot region:
p <- getRatioCoords(ratio=im.r, height=.5,
xleft=0, ytop=1, input='prop')
plot_image(img, type='image', add=TRUE,
xrange=p$x, yrange=p$y)
# Changing the ratio to square:
p <- getRatioCoords(ratio=1, height=.5,
xright=1, ybottom=0, input='prop')
plot_image(img, type='image', add=TRUE,
xrange=p$x, yrange=p$y)
# ... and to a long rectangle:
p <- getRatioCoords(ratio=.5, height=1,
xright=1, ybottom=0, input='prop')
plot_image(img, type='image', add=TRUE,
xrange=p$x, yrange=p$y,
replace.colors=list('#B.+'='#FF000033'),
border='red')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.