plot_density_2d: Produce a 2-d posterior density plot

View source: R/plotting.R

plot_density_2dR Documentation

Produce a 2-d posterior density plot

Description

Produce a 2-d posterior density plot, using a combined hexbin and contour plot, including gradient coloring to show the relative density.

Usage

plot_density_2d(
  data,
  x,
  y,
  bins = 50,
  levels = c(0.6826895, 0.9544997, 0.9973002)
)

Arguments

data

a CosmoSIS MCMC dataframe

x

the variable to be plotted on the x-axis

y

the variable to be plotted on the y-axis

bins

the numbers of bins for both 'x' and 'y'

levels

probability content to be included in each contour line

Value

a ggplot object

Examples

## Not run: 
  dirname <- system.file("extdata", "run20", package = "rcosmosis")
  fglob <- file.path(dirname, "chain_metro_20_*.txt.xz")
  samples <- read.metropolis.hastings(fglob)
  dplyr::filter(samples, sample > 100) |> plot_density_2d(omega_m, sigma8_input)

## End(Not run)

marcpaterno/rcosmosis documentation built on June 5, 2023, 6:43 p.m.