{"action":"created","issue":{"url":"https://api.github.com/repos/hadley/ggplot2/issues/1489","labels_url":"https://api.github.com/repos/hadley/ggplot2/issues/1489/labels{/name}","comments_url":"https://api.github.com/repos/hadley/ggplot2/issues/1489/comments","events_url":"https://api.github.com/repos/hadley/ggplot2/issues/1489/events","html_url":"https://github.com/hadley/ggplot2/issues/1489","id":126558315,"number":1489,"title":"theme_update(text) fails due to NULL values","user":{"login":"oneillkza","id":3099991,"avatar_url":"https://avatars.githubusercontent.com/u/3099991?v=3","gravatar_id":"","url":"https://api.github.com/users/oneillkza","html_url":"https://github.com/oneillkza","followers_url":"https://api.github.com/users/oneillkza/followers","following_url":"https://api.github.com/users/oneillkza/following{/other_user}","gists_url":"https://api.github.com/users/oneillkza/gists{/gist_id}","starred_url":"https://api.github.com/users/oneillkza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oneillkza/subscriptions","organizations_url":"https://api.github.com/users/oneillkza/orgs","repos_url":"https://api.github.com/users/oneillkza/repos","events_url":"https://api.github.com/users/oneillkza/events{/privacy}","received_events_url":"https://api.github.com/users/oneillkza/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-14T01:46:31Z","updated_at":"2016-01-25T18:27:19Z","closed_at":"2016-01-25T16:36:23Z","body":"It's possible, using `theme()`, to set individual font elements inline with plotting, eg (adapted from ggplot documentation example):\r\n\r\n```{r}\r\ndf <- data.frame(gp = factor(rep(letters[1:3], each = 10)), y = rnorm(30))\r\nggplot(df, aes(x = gp, y = y)) + \r\n    geom_point() +\r\n    theme(text=element_text(size=16))\r\n```\r\n\r\nHowever, when using theme_update to try to set this globally, it complains about `NULL` values in the `text` element.\r\n\r\n```{r}\r\ntheme_update(text=element_text(size=16))\r\nggplot(df, aes(x = gp, y = y)) + \r\n    geom_point()\r\n```\r\n\r\nresults in\r\n\r\n```\r\nError in FUN(X[[i]], ...) : \r\n  Theme element 'text' has NULL property: family, face, colour, hjust, vjust, angle, lineheight, margin, debug\r\n```\r\n\r\nI don't know if this is intended, but it seems strange that the behaviour of `theme()` and `update_theme()` is different, and it's frustrating that it isn't possible to set font size globally.\r\n\r\n(This is with `ggplot2_2.0.0`.)"},"comment":{"url":"https://api.github.com/repos/hadley/ggplot2/issues/comments/174611215","html_url":"https://github.com/hadley/ggplot2/issues/1489#issuecomment-174611215","issue_url":"https://api.github.com/repos/hadley/ggplot2/issues/1489","id":174611215,"user":{"login":"oneillkza","id":3099991,"avatar_url":"https://avatars.githubusercontent.com/u/3099991?v=3","gravatar_id":"","url":"https://api.github.com/users/oneillkza","html_url":"https://github.com/oneillkza","followers_url":"https://api.github.com/users/oneillkza/followers","following_url":"https://api.github.com/users/oneillkza/following{/other_user}","gists_url":"https://api.github.com/users/oneillkza/gists{/gist_id}","starred_url":"https://api.github.com/users/oneillkza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oneillkza/subscriptions","organizations_url":"https://api.github.com/users/oneillkza/orgs","repos_url":"https://api.github.com/users/oneillkza/repos","events_url":"https://api.github.com/users/oneillkza/events{/privacy}","received_events_url":"https://api.github.com/users/oneillkza/received_events","type":"User","site_admin":false},"created_at":"2016-01-25T18:27:19Z","updated_at":"2016-01-25T18:27:19Z","body":"I see. So the solution for actually updating a single element of an element of a theme is something like:\r\n\r\n```{r}\r\ntheme_update(text=(theme_grey()+theme(text = element_text(family = \"Times\")))$text )\r\n```\r\n\r\nThat's pretty ugly; I'd expect theme_update to pull the base theme settings from the theme being updated, rather than requiring them to all be specified. It's your package, though."}}