Reputation: 2067
I have a facetted point plot, and the facets are based on multiple factors:
p = p + facet_wrap(~ model + run, ncol = 1, scales = 'fixed')
I'm happy with ggplot2 using the existing unique values of model
and run
to build the facet labels, but I'd like to have them across one line, not multiple. However,
p = p + facet_wrap(~ model + run, ncol = 1, scales = 'fixed',
labeller = label_value(multi_line = FALSE)
results in a missing argument error, because label_value()
expects the argument labels
first:
Error in lapply(labels, as.character) :
argument "labels" is missing, with no default
I'm not sure how to supply this given there are multiple facetting variables specified. If I leave the labeller out entirely, ggplot2 seems happy to work it out itself.
Upvotes: 3
Views: 607
Reputation: 60080
You want to pass the function without calling it (it will be called with the labels when constructing the plot), so:
p = p + facet_wrap(~ model + run, ncol = 1, scales = 'fixed',
labeller = function(labs) {label_value(labs, multi_line = FALSE)})
Upvotes: 6