View source: R/guide_axis_logticks.R
guide_axis_logticks | R Documentation |
This axis guide is probably best described as
ggplot2::annotation_logticks()
but implemented as a guide instead
of a geom. The tick marks probably best suit log10 transformations.
The function is deprecated because ggplot2 implemented a better log tick
axis.
guide_axis_logticks(
title = waiver(),
check.overlap = FALSE,
angle = NULL,
n.dodge = 1,
order = 0,
position = waiver(),
prescaled = FALSE,
trunc_lower = NULL,
trunc_upper = NULL,
colour = NULL,
color = NULL,
base = waiver()
)
title |
A character string or expression indicating a title of guide.
If |
check.overlap |
silently remove overlapping labels, (recursively) prioritizing the first, last, and middle labels. |
angle |
Compared to setting the angle in
|
n.dodge |
The number of rows (for vertical axes) or columns (for horizontal axes) that should be used to render the labels. This is useful for displaying labels that would otherwise overlap. |
order |
A positive |
position |
Where this guide should be drawn: one of top, bottom, left, or right. |
prescaled |
A |
trunc_lower , trunc_upper |
The lower and upper range of the truncated axis:
|
colour , color |
A |
base |
When this is provided, the guide takes this as the base for the
log transformation instead of trying to guess the base. It is recommended
to use this argument if the base is not |
An axis_logticks guide class object.
This axis guide uses the following the theme elements:
ggh4x.axis.ticks.length.minor
An rel()
object to set the size of minor ticks
relative to the length of major ticks (axis.ticks.length
).
Defaults to rel(2/3)
.
ggh4x.axis.ticks.length.mini
An rel()
object to set the size of smallest ticks,
also relative to the length of major ticks (axis.ticks.length
).
Defaults to rel(1/3)
.
Other axis-guides:
guide_axis_manual()
,
guide_axis_minor()
,
guide_axis_nested()
,
guide_axis_scalebar()
,
guide_axis_truncated()
# The guide works well out of the box with log10 scales
p <- ggplot(pressure, aes(temperature, pressure)) +
geom_line()
p + scale_y_log10(guide = "axis_logticks")
# If the data is already transformed, you can set 'prescaled' to TRUE
ggplot(pressure, aes(temperature, log10(pressure))) +
geom_line() +
guides(y = guide_axis_logticks(prescaled = TRUE))
# The lenghts of the log-ticks are controlled by the theme relative to the
# major ticks.
p + scale_y_log10(guide = "axis_logticks") +
theme(
axis.ticks.length.y = unit(1, "cm"),
ggh4x.axis.ticks.length.minor = rel(0.55),
ggh4x.axis.ticks.length.mini = rel(0.1)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.