You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to have a base graphics version alongside a ggplot2 version of a plot inside a function which returns some other object.
The issue is the return statement makes plot_grid produce no output at all (inside RStudio plot pane at least).
If one gets rid of this statement, the plots do appear.
require(gridGraphics)
#> Loading required package: gridGraphics#> Loading required package: grid
require(cowplot)
#> Loading required package: cowplot
require(ggplot2)
#> Loading required package: ggplot2buggy_fun<-function() {
## Graphics### basebase.g<-~ {
plot(0:1, 0:1)
}
### ggplot2ggplot.g<- ggplot() +
geom_rect(aes(xmin=0, xmax=1, ymin=0, ymax=2), fill="green")
plot_grid(base.g, ggplot.g, nrow=2)
return(2) ## No side effect when something is returned from function
}
Hello.
I'd like to have a base graphics version alongside a ggplot2 version of a plot inside a function which returns some other object.
The issue is the
return
statement makesplot_grid
produce no output at all (insideRStudio
plot pane at least).If one gets rid of this statement, the plots do appear.
Created on 2022-05-02 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: