I am trying to use the plot.title.position argument in a ggplot like so
library(dplyr)
iris %>%
filter(Sepal.Length > 5.5) %>%
group_by(Species) %>%
summarise(n=n()) %>%
ggplot(aes(x=Species, y=n)) +
geom_col() +
ggtitle("Long Sepal Iris by Species") +
theme(axis.title.x=element_blank(),
axis.title.y=element_blank(),
plot.title.position = "plot")
But I see
Error in (function (el, elname) :
"plot.title.position" is not a valid theme element name.
The ggplot2 manual says
plot.title.position, plot.caption.position
Alignment of the plot title/subtitle and caption. The setting for plot.title.position applies to both the title and the subtitle. A value of "panel" (the default) means that titles and/or caption are aligned to the plot panels. A value of "plot" means that titles and/or caption are aligned to the entire plot (minus any space for margins and plot tag).
Notes
> packageVersion('ggplot2')
[1] ‘3.2.1’
And
> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.1
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] wordcloud2_0.2.1 scales_1.0.0 forcats_0.4.0 stringr_1.4.0 purrr_0.3.3 readr_1.3.1
[7] tidyr_1.0.0 tibble_2.1.3 tidyverse_1.2.1 dplyr_0.8.99.9002 ggplot2_3.2.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4 lubridate_1.7.4 lattice_0.20-38 prettyunits_1.0.2 ps_1.3.0
[6] assertthat_0.2.1 digest_0.6.25 R6_2.4.1 cellranger_1.1.0 backports_1.1.5
[11] stats4_3.6.2 httr_1.4.1 pillar_1.4.3 rlang_0.4.5.9000 lazyeval_0.2.2
[16] readxl_1.3.1 rstudioapi_0.10 data.table_1.12.2 callr_3.2.0 Matrix_1.2-18
[21] labeling_0.3 loo_2.2.0 htmlwidgets_1.3 munsell_0.5.0 broom_0.5.2
[26] compiler_3.6.2 modelr_0.1.4 xfun_0.12 rstan_2.19.2 pkgconfig_2.0.3
[31] pkgbuild_1.0.3 htmltools_0.3.6 tidyselect_1.0.0 gridExtra_2.3 matrixStats_0.55.0
[36] fansi_0.4.1 viridisLite_0.3.0 crayon_1.3.4 withr_2.1.2 grid_3.6.2
[41] nlme_3.1-142 jsonlite_1.6.1 gtable_0.3.0 lifecycle_0.2.0 magrittr_1.5
[46] StanHeaders_2.21.0-1 cli_2.0.2 stringi_1.4.6 xml2_1.2.2 ellipsis_0.3.0
[51] generics_0.0.2 vctrs_0.2.99.9010 RColorBrewer_1.1-2 tools_3.6.2 Cairo_1.5-10
[56] glue_1.3.2 hms_0.4.2 yaml_2.2.1 parallel_3.6.2 processx_3.3.0
[61] inline_0.3.15 colorspace_1.4-1 rvest_0.3.4 plotly_4.9.0 knitr_1.27.2
[66] haven_2.1.1