We issue a clear warning below but new users may not understand the severity. A better error message when rendering the plot would be an improvement ``` r library(ggplot2) # missing () theme_set(theme_bw) #> Warning: New theme missing the following elements: line, #> rect, text, axis.title.x, axis.title.x.top, axis.title.y, #> axis.title.y.right, axis.text, axis.text.x, axis.text.x.top, #> axis.text.y, axis.text.y.right, axis.ticks, axis.ticks.length, #> axis.line, axis.line.x, axis.line.y, legend.background, legend.margin, #> legend.spacing, legend.spacing.x, legend.spacing.y, legend.key, #> legend.key.size, legend.key.height, legend.key.width, legend.text, #> legend.text.align, legend.title, legend.title.align, legend.position, #> legend.direction, legend.justification, legend.box, legend.box.margin, #> legend.box.background, legend.box.spacing, panel.background, #> panel.border, panel.spacing, panel.spacing.x, panel.spacing.y, #> panel.grid, panel.grid.minor, panel.ontop, plot.background, plot.title, #> plot.subtitle, plot.caption, plot.tag, plot.tag.position, plot.margin, #> strip.background, strip.placement, strip.text, strip.text.x, strip.text.y, #> strip.switch.pad.grid, strip.switch.pad.wrap ggplot(mtcars) #> Error in y[setdiff(names(y), names(x))]: object of type 'closure' is not subsettable ```  Created on 2019-02-06 by the [reprex package](http://reprex.tidyverse.org) (v0.2.0).
Activity
clauswilke commentedon Feb 6, 2019
I'm in the process of rewriting how themes are set, combined, and processed (#2784), so it'll probably make sense to fix this issue in that rewrite.
clauswilke commentedon May 20, 2022
The error is now different. At least it points to a problem with themes. Not sure if it can be improved further.
Created on 2022-05-20 by the reprex package (v2.0.0)