# NOT RUN {
# 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)
)
# }
Run the code above in your browser using DataLab