pubs_per_year: Number of publications per year

View source: R/plot.R

pubs_per_yearR Documentation

Number of publications per year

Description

Plot bar plot of the number of publications per year. I find facetting makes the plot easier to read than filling with different colors.

Usage

pubs_per_year(
  pubs,
  facet_by = NULL,
  fill_by = NULL,
  binwidth = 365,
  preprints = TRUE,
  n_top = Inf,
  n_top_fill = Inf,
  sort_by = c("first_appeared", "count", "recent_count"),
  log_color = FALSE
)

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.

facet_by

Name of a column for facetting.

fill_by

Name of a column of a categorical variable with which to color the histogram.

binwidth

Width of bins for the histogram in days.

preprints

Logical, whether preprints should be included. Defaults to 'TRUE' to include preprints.

n_top

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

n_top_fill

Number of categories with the most publications to be differentiated by color.

sort_by

How to sort the facets. first_appeared means the category that appeared earlier will be nearer to the top. count means the category with more count (number of publications) will be nearer to the top. Ignored if not facetting.

log_color

If filling histograms by integer values, whether to log transform the values before mapping to colors to improve dynamic range.

Value

A ggplot2 object.


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