wilkelab / cowplot

cowplot: Streamlined Plot Theme and Plot Annotations for ggplot2
https://wilkelab.org/cowplot/
701 stars 84 forks source link

Using expressions in plot text generates warnings #178

Open plantarum opened 2 years ago

plantarum commented 2 years ago

To add italics, or other fancy symbols, to the text on a plot, I use expression:

plot(1:10, main = expression(italic("Italic Title")))

This generates a plot with the title in italics. If I use such a plot in cowplot, it generates warnings:

italic_plot <- function(){
  plot(1:10, main = expression(italic("Italic Title")))
}

plot_grid(italic_plot, italic_plot)
> plot_grid(italic_plot, italic_plot)
Warning in is.na(x) :
  is.na() applied to non-(list or vector) of type 'expression'
Warning in is.na(x) :
  is.na() applied to non-(list or vector) of type 'expression'

Depending on the complexity of the panels I'm preparing, this can generate a bit of noise in the terminal. Is there someway to avoid this?