Learn R Programming

CosmoPhotoz (version 0.1)

plotDiagPhotoZ: Plot diagnostics for photometric redshift estimations

Description

plotDiagPhotoZ returns diagnostic plots from the results of photometric redshifts. Different types of plots are available: a density plot of the error distribution (errordist), a predicted versus observed contour plot (predobs), violin plot showing the error distribution at different redshift bins (errorviolins) and a box plot showing the errors at each different redshift bin (box). The produced plots are returned as ggplot2 objects.

Usage

plotDiagPhotoZ(photoz, specz, type, npoints)

Arguments

photoz
vector containing photoz data
specz
vector containing spectroscopic redshift data
type
a string with one of the following values: errordist, predobs, errorviolins or box
npoints
an integer indicating how many points should be used to create the predobs plot (if 0, all points will be used)

Value

ggplot object

Examples

Run this code
# First, generate some mock data
ppo <- runif(1000, min=0.1, max=2)
ppo_ph <- rnorm(length(ppo), mean=ppo, sd=0.05)

# Then generate the plots
plotDiagPhotoZ(ppo_ph, ppo, type="errordist")
#plotDiagPhotoZ(ppo_ph, ppo, type="predobs")
#plotDiagPhotoZ(ppo_ph, ppo, type="errorviolins")
#plotDiagPhotoZ(ppo_ph, ppo, type="box")

Run the code above in your browser using DataLab