adefazio / classifierplots

Generates a visualization of binary classifier performance as a grid of diagonstic plots with just one function call
Other
48 stars 7 forks source link

Grobs don't render in Rmarkdown #12

Open NBRAYKO opened 7 years ago

NBRAYKO commented 7 years ago

The individual pieces that make up a classifierplot object render fine when you add them in an Rmd chunk, but when you include a the actual classifierplots function, it just prints out the message.

This works

density_plot(test_dat$Outcome, 
                        test_dat$PredEns)

This does not

grobEns <- classifierplots(test_dat$Outcome,
                        test_dat$PredEns) 
grobEns

And neither does this

gridExtra::grid.arrange(grobEns, 
                                top=textGrob("Ensemble model",
                      gp=gpar(fontsize=16,font=1)))
adefazio commented 7 years ago

Try grid::grid.draw(grobEns). I'm not really sure why the gTable objects act differently than grobs when you call print on them, they inherit from grob. It's caused problems for other users of arrangeGrob as well. I'm not sure what the best way to fit it is. Perhaps returning a custom class with print that calls grid.draw.