Function reference
Basemap functions
Maps are plotted using the basemap()
or qmap()
functions that work almost similarly to ggplot()
as a base for adding further layers to the plot using the +
operator. The maps generated this way already contain multiple ggplot layers. Consequently, the data
argument needs to be explicitly specified inside geom_*
functions when adding ggplot2
layers. Depending on the location of the map, the underlying coordinates may be projected. Decimal degree coordinates need to be transformed to the projected coordinates using the transform_coord
, ggspatial, or geom_sf
functions.. The shapefile_list
function can be used to acquire shapefiles
argument names when limiting basemaps using projected coordinates.
-
basemap()
- Create a ggplot2 basemap for plotting variables
-
qmap()
- Quick map
-
transform_coord()
- Transform spatial coordinates to another projection
-
shapefile_list()
- A list of pre-made shapefiles for
basemap
-
dist2land()
- Calculate distance to the closest land for coordinates
-
get_depth()
- Extract depth for coordinates from a raster bathymetry dataset
Functions to help customizing basemaps
These functions help in customizing basemaps. The auto_limits
function can be used to retrieve projected coordinates from decimal degree position data and the reorder_layers
can be used to move land and glaciers on top of added ggplot2 data layers.
-
auto_limits()
- Automatic limits for basemap
-
reorder_layers()
- Move
basemap
land, glacier and grid layers on top of other ggplot layers
-
theme_map()
- A ggplot2 theme for maps
Create bathymetries and shapefiles
Custom bathymetry shapes can be added using the raster_bathymetry
and vector_bathymetry
functions in this order. The underlying data can be retrieved from the ETOPO or GEBCO repositories. Already existing Geonorge bathymetries can be opened and added to the shapefiles
argument as list(bathy =)
. The clip_shapefile
function can be used to crop already existing SpatialPolygons.
-
raster_bathymetry()
- Simplify a bathymetry raster ready for vectorization
-
vector_bathymetry()
- Create a polygon bathymetry from a raster bathymetry file
-
geonorge_bathymetry()
- Open Geonorge bathymetry shapefiles
-
clip_shapefile()
- Clip a shapefile using a bounding area
-
rotate_crs()
- Rotate CRS
Size adjustment functions
These functions convert line widths and font sizes measured in points (pt) to ggplot2 equivalents. They can be used to follow line width and font size requirements set by journals.
-
LS()
- Convert line sizes measured as points to ggplot line sizes
-
FS()
- Convert font sizes measured as points to ggplot font sizes
Map data
Shape- and raster files used by the package. Higher resolution files are stored in the ggOceanMapsLargeData repository. These files are automatically used by the basemap function. The basemap
function also supports custom sf and stars objects.
Datasets
The package contains ICES and Norwegian Directorate of Fisheries areas as sf objects. These shapefiles are used in examples and included here for convenience because they are regularly needed by the package author.
-
ices_areas
- ICES Advisory Areas
-
fdir_main_areas
- Major fisheries areas (hovedomraade) of Norway
-
fdir_sub_areas
- Norwegian sub-areas (lokasjon) for commercial fishing
Internal basemap functions
Internal functions dealing with data and graphics for basemap. These functions are run on the background and only needed if you modify your maps beyond the options offered by ggOceanMaps.
-
basemap_data()
- Create basemapData object for basemap plotting
-
define_shapefiles()
- Define a shapefile to use in plotting from the limits argument
-
guess_coordinate_columns()
- Guess longitude and latitude columns in a data frame
-
is_decimal_limit()
- Test whether a limit argument is specified as decimal degrees.
-
map_cmd()
- Return map elements for basemap
-
round_any()
- Round to multiple of any number
-
quiet()
- Return function output quietly
-
dd_to_deg()
- Convert decimal degree values to angular degrees
-
deg_to_dd()
- Convert angular degrees to decimal degree values
-
select_element()
- Select an element of each vector from a list
-
dd_clip_boundary()
- Create clip boundary from decimal degree limits