scaleBar2 | R Documentation |
Place a single horizontal scale bar of length distance
as per
scale factor scale
with unit of measure units
.
scaleBar2(
x,
y = NULL,
distance,
scale,
units = "µm",
col = "white",
col.text,
cex = 3/4,
adj = c(0.5, -0.5),
col.line,
lwd = 1,
lend = 1,
xpd = NA,
...
)
x , y |
Central coordinates of the scale bar in pixels |
distance |
Distance represented by the scale bar in microns |
scale |
Image scale as µm per pixel |
units |
Unit of measure, default of "µm". Use |
col |
Default color (white) for |
col.text , cex , adj , xpd , ... |
Parameters passed to the |
col.line , lwd , lend |
Parameters passed to the |
This is a utility to place a labeled scale bar on a raster image.
A default label will include the distance in µm if unit
is not
NA
. The label is centered at the position specified by x,y
according to adj
. The default value for adj
of
c(0.5,-0.5)
centers the label and places it 0.5 character widths
above x,y
.
The x,y
coordinates can be passed in a plotting structure
appropriate for xy.coords
. This function attempts to parse
distance
and scale
from the remaining arguments if they are
not named and if x
is a list with components named "x" and "y". This
allows one to interactively place a scale bar with a function
call such as in the following example. In this example, scale
is
the scale factor as "µm per pixel."
This call will place a labeled 25 µm scale bar on the image as per the
value in scale
> scaleBar(locator(), 25, scale)
Note that this is not a vectorized function. Only the last
value of (x, y)
will be used to place the scale bar. This allows
multiple clicks to locator()
to get the position just right
with only the last click being used.
Micrometers-per-pixels calibration values for the Nikon TE300 at 1x1 binning with the QImaging camera are:
Objective scale factor 20X ELWD 0.3228 40X ELWD 0.1624 60X ELWD 0.1062 60X Apo 0.1064 100X Apo 0.0640 4X Apo 1.613 (estimated)
This function is called for side effects but the location is returned invisibly as a list.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.