Maps are plotted using the
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.
- Create a ggplot2 basemap for plotting variables
- Quick map
- Transform spatial coordinates to another projection
- A list of pre-made shapefiles for
- Calculate distance to the closest land for coordinates
- Extract depth for coordinates from a raster bathymetry dataset
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.
- Automatic limits for basemap
basemapland, glacier and grid layers on top of other ggplot layers
- A ggplot2 theme for maps
Custom bathymetry shapes can be added using the
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.
- Simplify a bathymetry raster ready for vectorization
- Create a polygon bathymetry from a raster bathymetry file
- Open Geonorge bathymetry shapefiles
- Clip a shapefile using a bounding area
- Rotate CRS
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.
- Convert line sizes measured as points to ggplot line sizes
- Convert font sizes measured as points to ggplot font sizes
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.
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 Advisory Areas
- Major fisheries areas (hovedomraade) of Norway
- Norwegian sub-areas (lokasjon) for commercial fishing
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.
- Create basemapData object for basemap plotting
- Define a shapefile to use in plotting from the limits argument
- Guess longitude and latitude columns in a data frame
- Test whether a limit argument is specified as decimal degrees.
- Return map elements for basemap
- Round to multiple of any number
- Return function output quietly
- Convert decimal degree values to angular degrees
- Convert angular degrees to decimal degree values
- Select an element of each vector from a list
- Create clip boundary from decimal degree limits