pubs_on_map: Plot number of publications at each location

View source: R/plot.R

pubs_on_mapR Documentation

Plot number of publications at each location

Description

Plots points on a map, and the areas of the points are proportional to the number of publications at the location. Can facet by some category like method or species.

Usage

pubs_on_map(
  pubs,
  city_gc,
  zoom = c("world", "europe", "usa", "ne_asia"),
  plot = c("point", "bin2d", "hexbin"),
  facet_by = NULL,
  n_top = Inf,
  ncol = 3,
  label_insts = TRUE,
  label_cities = FALSE,
  n_label = 10,
  per_year = FALSE,
  bins = c(70, 70)
)

Arguments

pubs

A data frame with at least these columns:

journal

Name of the journal of the paper.

year

Year when the paper was published.

There must be one row per publication or per method or species for each title if faceting by those. If facetting, then a column whose name is the value in 'facet_by' must be present.

city_gc

From geocode_inst_city

zoom

Whether to plot the world map or only Europe (centered on Western Europe and some Eastern European countries are partially cropped off) or only the US or only northeast Asia.

plot

Whether to plot points, rectangular bins (bin2d), or hexagonal bins (hexbin). The binned options are useful when there's overplotting.

facet_by

Name of a column for facetting.

n_top

Number of categories with the most publications to plot in facets; the other categories are lumped into "other".

ncol

Number of columns in facetted plot.

label_insts

Logical, whether to label institutions.

label_cities

Logical, whether to label cities.

n_label

Number of top cities to label, so the labels won't clutter the plot.

per_year

Logical, whether to do the count for each year separately. This is for making animations with gganimate.

bins

Numeric vector of length 2, the number of bins for bin2d or hex in the x and y directions. Ignored if plotting points.

Details

World map will use the Robinson projection. European map uses the LAEA Europe projection (EPSG:3035), and the American map uses the US National Atlas Equal Area projection (EPSG:2163) and Alaska and Hawaii are moved and included. The option to zoom in on Europe and the US is available because those are the two regions of the world with the most publications and it's hard to see the data when plotted on a world map.

Value

A ggplot2 object


pachterlab/museumst documentation built on April 20, 2024, 11:26 p.m.