Learn R Programming

ggOceanMaps (version 1.1)

qmap: Quick map

Description

qmap is a shortcut similar to ggplot2's qplot designed to quickly plot data with a limited range of options.

Usage

qmap(
  data,
  x = NULL,
  y = NULL,
  geom = "point",
  limits = NULL,
  bathymetry = FALSE,
  glaciers = FALSE,
  resolution = "low",
  rotate = FALSE,
  legends = TRUE,
  legend.position = "right",
  lon.interval = NULL,
  lat.interval = NULL,
  bathy.style = "poly_blues",
  bathy.border.col = NA,
  bathy.size = 0.1,
  land.col = "grey60",
  land.border.col = "black",
  land.size = 0.1,
  gla.col = "grey95",
  gla.border.col = "black",
  gla.size = 0.1,
  grid.col = "grey70",
  grid.size = 0.1,
  base_size = 11,
  projection.grid = FALSE,
  verbose = FALSE,
  ...
)

Arguments

data

Data frame to use.

x, y, ...

Aesthetics passed into each layer. Longitude and latitude columns are automatically recognized using the guess_coordinate_columns function.

geom

Character argument specifying geom(s) to draw. Defaults to "point". Other geoms have not been implemented yet.

limits

Map limits. See the limits argument in basemap. If NULL the limits are automatically taken from data

bathymetry

Logical indicating whether bathymetry should be added to the map.

glaciers

Logical indicating whether glaciers and ice-sheets should be added to the map.

resolution

Not implemented yet.

rotate

Logical indicating whether the projected maps should be rotated to point towards the pole relative to mid-longitude limit. Experimental.

legends

Logical indicating whether the legend for bathymetry should be shown.

legend.position

The position for ggplot2 legend. See the argument with the same name in theme.

lon.interval, lat.interval

Numeric value specifying the interval of longitude and latitude grids. NULL finds reasonable defaults depending on limits.

bathy.style

Character defining the style for bathymetry contours. Alternatives:

  • "poly_blues" plots polygons filled with different shades of blue.

  • "poly_greys" plots polygons filled with different shades of gray.

  • "contour_blues" contour lines with different shades of blue.

  • "contour_grey" plots gray contour lines.

land.col, gla.col, grid.col

Character code specifying the color of land, glaciers and grid lines, respectively. Use NA to remove the grid lines.

land.border.col, gla.border.col, bathy.border.col

Character code specifying the color of the border line for land, glacier, and bathymetry shapes.

land.size, gla.size, bathy.size, grid.size

Numeric value specifying the width of the border line land, glacier and bathymetry shapes as well as the grid lines, respectively. Use the LS function for a specific width in pt. See Details.

base_size

Base size parameter for ggplot. See ggtheme.

projection.grid

Logical indicating whether the coordinate grid should show projected coordinates instead of decimal degree values. Useful to define limits for large maps in polar regions.

verbose

Logical indicating whether information about the projection and guessed column names should be returned as message. Set to FALSE to make the function silent.

Value

Returns a ggplot map, which can be assigned to an object and modified as any ggplot object.

See Also

Other basemap functions: basemap(), shapefile_list(), transform_coord()

Examples

Run this code
# NOT RUN {
dt <- data.frame(lon = c(-100, -80, -60), lat = c(10, 25, 40), var = c("a", "a", "b"))

# Set color

if(requireNamespace("ggOceanMapsData")) {
qmap(dt, color = I("red")) 
}
# Map color
# }
# NOT RUN {
qmap(dt, color = var) 
# }
# NOT RUN {
dt <- data.frame(lon = c(-80, -80, -50, -50), lat = c(65, 80, 80, 65))

if(requireNamespace("ggOceanMapsData")) {
qmap(dt, rotate = TRUE)
}

# }

Run the code above in your browser using DataLab