I'm trying to generate ROC curve and precision-recall curve using the library "yardstick". However, I could not find a way to modify the figure shape. Here's a toy example.
## Precision-recall curve
data.frame(true = as.factor(rep(c(0,1), 10)),
pred = runif(20)) %>%
pr_curve(truth = true, pred) %>%
autoplot()
## ROC curve
data.frame(true = as.factor(rep(c(0,1), 10)),
pred = runif(20)) %>%
roc_curve(truth = true, pred) %>%
autoplot()
When you run the codes, the generated figures look like below;
The top figure (ROC curve) is in a square form, while the bottom one (precision-recall curve) is a rectangle.
I've tried to
change
width
andheight
options inpdf
functionchange different options supported by ggplot2 (e.g.
plot.margin
usingtheme
)
but could not find a good way to make two figures in the same shape.
How could I unify their shapes (or forms)?
Any comment will be very appreciated.