nTick: [+] Control number of ticks in 'ggplot2' plots with...

Description Usage Arguments Author(s) See Also Examples

Description

Convenience function to control number of ticks in ggplot2 plots with continuous scale.

Usage

1
2
3
nTick_x(n = 2, min.n = 2, ..., pretty.args = list())

nTick_y(n = 2, min.n = 2, ..., pretty.args = list())

Arguments

n

An Integer giving the desired number of intervals. Non-integer values are rounded down.

min.n

nonnegative integer giving the minimal number of intervals. If min.n == 0, pretty(.) may return a single value.

...

Further parameters to be passed to appropriate function which is either scale_x_continuous for nTick_x or scale_y_continuous for nTick_y.

pretty.args

Further parameters to be passed to function pretty.

Author(s)

Vilmantas Gegzna

See Also

Pretty breakpoints: pretty.

Other spPlot functions for ggplot2: facet_wl(), ggLims(), gg_palette(), ggplot.hyperSpec()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(spHelper)

library(spPlot)
library(ggplot2)

# Make a plot but do not print
p <- qplot_spStat(Spectra2, "gr", mean, All.linetype = "solid") + facet_grid(.~gr)

#Print the plot
p

# Correct number of ticks:
p + nTick_x(2)
p + nTick_x(2) + nTick_y(8)

GegznaV/spPlot documentation built on April 29, 2020, 11:06 p.m.