-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathscale_longitude.Rd
134 lines (121 loc) · 3.86 KB
/
scale_longitude.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scale_longitude.R
\name{scale_longitude}
\alias{scale_longitude}
\alias{scale_x_longitude}
\alias{scale_latitude}
\alias{scale_y_longitude}
\alias{scale_x_latitude}
\alias{scale_y_latitude}
\alias{scale_x_level}
\alias{scale_y_level}
\title{Helpful scales for maps}
\usage{
scale_x_longitude(
name = "",
ticks = 30,
breaks = seq(-180, 360, by = ticks),
expand = c(0, 0),
labels = LonLabel,
...
)
scale_y_longitude(
name = "",
ticks = 60,
breaks = seq(-180, 360, by = ticks),
expand = c(0, 0),
labels = LonLabel,
...
)
scale_x_latitude(
name = "",
ticks = 30,
breaks = seq(-90, 90, by = ticks),
expand = c(0, 0),
labels = LatLabel,
...
)
scale_y_latitude(
name = "",
ticks = 30,
breaks = seq(-90, 90, by = ticks),
expand = c(0, 0),
labels = LatLabel,
...
)
scale_x_level(name = "", expand = c(0, 0), trans = "reverselog", ...)
scale_y_level(name = "", expand = c(0, 0), trans = "reverselog", ...)
}
\arguments{
\item{name}{The name of the scale. Used as the axis or legend title. If
\code{waiver()}, the default, the name of the scale is taken from the first
mapping used for that aesthetic. If \code{NULL}, the legend title will be
omitted.}
\item{ticks}{spacing between breaks}
\item{breaks}{One of:
\itemize{
\item \code{NULL} for no breaks
\item \code{waiver()} for the default breaks computed by the
\link[scales:new_transform]{transformation object}
\item A numeric vector of positions
\item A function that takes the limits as input and returns breaks
as output (e.g., a function returned by \code{\link[scales:breaks_extended]{scales::extended_breaks()}}).
Note that for position scales, limits are provided after scale expansion.
Also accepts rlang \link[rlang:as_function]{lambda} function notation.
}}
\item{expand}{For position scales, a vector of range expansion
constants used to add some padding around the data to ensure
that they are placed some distance away from the axes.
Use the convenience function \code{\link[ggplot2:expansion]{ggplot2::expansion()}} to generate
the values for the expand argument.}
\item{labels}{One of:
\itemize{
\item \code{NULL} for no labels
\item \code{waiver()} for the default labels computed by the
transformation object
\item A character vector giving labels (must be same length as \code{breaks})
\item An expression vector (must be the same length as breaks). See ?plotmath for details.
\item A function that takes the breaks as input and returns labels
as output. Also accepts rlang \link[rlang:as_function]{lambda} function
notation.
}}
\item{...}{Other arguments passed on to \verb{scale_(x|y)_continuous()}}
\item{trans}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Deprecated in favour of
\code{transform}.}
}
\description{
These functions are simple wrappers around
\code{\link[ggplot2]{scale_x_continuous}} and
\code{\link[ggplot2]{scale_y_continuous}} with
helpful defaults for plotting longitude, latitude and pressure levels.
}
\examples{
data(geopotential)
library(ggplot2)
ggplot(geopotential[date == date[1]], aes(lon, lat, z = gh)) +
geom_contour() +
scale_x_longitude() +
scale_y_latitude()
data(temperature)
ggplot(temperature[lon == lon[1] & lat == lat[1]], aes(air, lev)) +
geom_path() +
scale_y_level()
}
\seealso{
Other ggplot2 helpers:
\code{\link{MakeBreaks}()},
\code{\link{WrapCircular}()},
\code{\link{geom_arrow}()},
\code{\link{geom_contour2}()},
\code{\link{geom_contour_fill}()},
\code{\link{geom_label_contour}()},
\code{\link{geom_relief}()},
\code{\link{geom_streamline}()},
\code{\link{guide_colourstrip}()},
\code{\link{map_labels}},
\code{\link{reverselog_trans}()},
\code{\link{scale_divergent}},
\code{\link{stat_na}()},
\code{\link{stat_subset}()}
}
\concept{ggplot2 helpers}