minorLogTicksAxis | R Documentation |
Display major and minor tick marks for log-scale axis,
with optional offset for proper labeling of log2(1+x)
with numeric offset.
minorLogTicksAxis(
side = NULL,
lims = NULL,
logBase = 2,
displayBase = 10,
offset = 0,
symmetricZero = (offset > 0),
majorCex = 1,
minorCex = 0.65,
doMajor = TRUE,
doLabels = TRUE,
doMinorLabels = TRUE,
asValues = TRUE,
padj = NULL,
doFormat = TRUE,
big.mark = ",",
scipen = 10,
minorWhich = c(2, 5),
logStep = 1,
cex = 1,
las = 2,
col = "black",
col.ticks = col,
minorLogTicksData = NULL,
verbose = FALSE,
...
)
side |
|
lims |
NULL or |
logBase |
|
displayBase |
|
offset |
|
symmetricZero |
|
majorCex , minorCex |
|
doMajor , doLabels , doMinorLabels |
|
asValues |
|
padj |
|
doFormat |
|
big.mark , scipen |
arguments passed to |
minorWhich |
|
logStep |
|
cex , col , col.ticks , las |
parameters used for axis label size, axis label colors, axis tick mark colors, and label text orientation, respectively. |
minorLogTicksData |
|
verbose |
|
... |
Additional arguments are ignored. |
This function displays log units on the axis of an
existing base R plot. It calls jamba::minorLogTicks()
which
calculates appropriate tick and label positions.
Note: This function assumes the axis values have already been
log-transformed. Make sure to adjust the offset
to reflect
the method of log-transformation, for example:
log2(1+x)
would require logBase=2
and offset=1
in order
to represent values properly at or near zero.
log(0.5+x)
would require logBase=exp(1)
and offset=0.5
.
log10(x)
would require logBase=10
and offset=0
.
The defaults logBase=2
and displayBase=10
assume data
has been log2-transformed, and displays tick marks using the
common base of 10. To display tick marks at two-fold intervals,
use displayBase=2
.
This function was motivated in order to label log-transformed
data properly in some special cases, like using log2(1+x)
where the resulting values are shifted "off by one" using
standard log-scaled axis tick marks and labels.
For log fold changes, set symmetricZero=TRUE
, which will
create negative log scaled fold change values as needed for
negative values. For example, this option would label a
logBase=2
value of -2
as -4
and not as 0.25
.
Note that by default, whenever offset > 0
the argument
symmetricZero=TRUE
is also defined, since a negative value in
that scenario has little meaning. This behavior can be turned
off by setting symmetricZero=FALSE
.
list
with vectors:
majorLabels
: character
vector of major axis labels
majorTicks
: numeric
vector of major axis tick positions
minorLabels
: character
vector of minor axis labels
minorTicks
: numeric
vector of minor axis tick positions
allLabelsDF
: data.frame
containing all axis tick
positions and corresponding labels.
Other jam plot functions:
adjustAxisLabelMargins()
,
coordPresets()
,
decideMfrow()
,
drawLabels()
,
getPlotAspect()
,
groupedAxis()
,
imageByColors()
,
imageDefault()
,
nullPlot()
,
plotPolygonDensity()
,
plotRidges()
,
plotSmoothScatter()
,
shadowText()
,
shadowText_options()
,
showColors()
,
sqrtAxis()
,
usrBox()
plotPolygonDensity(0:100, breaks=100);
plotPolygonDensity(0:100, breaks=100, log="x",
main="plotPolygonDensity() uses minorLogTicksAxis()",
xlab="x (log-scaled)");
plotPolygonDensity(log2(1+0:100), breaks=100,
main="manually called minorLogTicksAxis(logBase=2)",
xaxt="n",
xlab="x (log-scaled)");
minorLogTicksAxis(1, offset=1, logBase=2);
plotPolygonDensity(log10(1+0:100), breaks=100,
main="manually called minorLogTicksAxis(logBase=10)",
xaxt="n",
xlab="x (log-scaled)");
minorLogTicksAxis(1, offset=1, logBase=10);
plotPolygonDensity(log10(1+0:100), breaks=100,
main="using 'minorWhich=2:9'",
xaxt="n",
xlab="x (log-scaled)");
minorLogTicksAxis(1, offset=1, logBase=10,
minorWhich=2:9);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.