| scale_longitude | R Documentation |
These functions are simple wrappers around
scale_x_continuous and
scale_y_continuous with
helpful defaults for plotting longitude, latitude and pressure levels.
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", ...)
name |
The name of the scale. Used as the axis or legend title. If
|
ticks |
spacing between breaks |
breaks |
One of:
|
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 |
labels |
One of:
|
... |
Other arguments passed on to |
trans |
Other ggplot2 helpers:
MakeBreaks(),
WrapCircular(),
geom_arrow(),
geom_contour2(),
geom_contour_fill(),
geom_label_contour(),
geom_relief(),
geom_streamline(),
guide_colourstrip(),
map_labels,
reverselog_trans(),
scale_divergent,
stat_na(),
stat_subset()
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.