-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plotting method for slab()
output
#97
Comments
This will also require an overhaul of The solution for now is to load via library(aqp)
library(lattice)
## I don't know why, but loading the tactile library messes things up...
s <- lapply(1:100, random_profile, n_prop = 2, method = 'LPP', SPC = TRUE)
s <- combine(s)
site(s)$group <- factor(sample(c('A', 'B'), size = length(s), replace = TRUE))
table(s$group)
a <- slab(s, ~ p1 + p2)
## works
xyplot(
top ~ p.q50 | variable, data = a,
lower = a$p.q25, upper = a$p.q75,
sync.colors = TRUE,
alpha = 0.5,
cf = a$contributing_fraction,
xlab = 'Median Bounded by IQR',
ylab = 'Depth (cm)',
ylim = c(125,-5), layout = c(2,1),
scales = list(x = list(relation = 'free')),
par.settings = tactile::tactile.theme(superpose.line=list(lwd=2)),
panel = panel.depth_function,
prepanel = prepanel.depth_function,
strip = strip.custom(bg = grey(0.85)),
auto.key = list(columns = 2, lines = TRUE, points = FALSE)
)
## works
a <- slab(s, group ~ p1 + p2)
tps <- tactile::tactile.theme(superpose.line=list(lwd=2))
xyplot(
top ~ p.q50 | variable, data = a,
groups = group,
lower = a$p.q25, upper = a$p.q75,
sync.colors = TRUE,
alpha = 0.2,
cf = a$contributing_fraction,
xlab = 'Median Bounded by IQR',
ylab = 'Depth (cm)',
ylim = c(125,-5), layout = c(2,1),
scales = list(x = list(relation = 'free')),
par.settings = tps,
panel = panel.depth_function,
prepanel = prepanel.depth_function,
strip = strip.custom(bg = grey(0.85)),
auto.key = list(columns = 2, lines = TRUE, points = FALSE)
) |
dylanbeaudette
added a commit
that referenced
this issue
Oct 15, 2021
dylanbeaudette
added a commit
that referenced
this issue
Oct 15, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current approach to plotting the output from
slab()
requires considerable work, vialattice
orggplot2
. For example:There are several places where the source object (
g.slab
) is referenced; leaving plenty of opportunity of mistakes upon copy/paste from a manual page.One possible solution: a bare-bones plotting method (
lattice
orggplot2
, maybe two functions?) for the standardized output fromslab()
. Arguments set the y-variable of interest, optional paneling groups, and optional groups symbolized via colors. Additional arguments set upper/lower width via column names, contributing fraction annotation, and adjustments to transparency and syncing of colors. The basic plot object is then modified viaupdate()
. There must be a similar strategy forggplot2
graphics.Maybe something like this.
The text was updated successfully, but these errors were encountered: