yardstick icon indicating copy to clipboard operation
yardstick copied to clipboard

autoplot.conf_mat() text is hard to read at times

Open EmilHvitfeldt opened this issue 2 years ago • 1 comments

High frequency areas of the conf_mat() can be hard to read because of the contrast. something should be done.

It is hard because sometime the text isn't super needed (at a glance you can read the plot with the grey), and sometimes it would be nice to read the numbers directly

library(yardstick)
library(ggplot2)

two_class_example |>
  conf_mat(truth, predicted) |>
  autoplot(type = "heatmap")

Created on 2023-07-11 with reprex v2.0.2

EmilHvitfeldt avatar Jul 11 '23 19:07 EmilHvitfeldt

If I use different color scales, the high-frequency features become more difficult to read like

library(yardstick)
library(ggplot2)
library(colorspace)

two_class_example |>
  conf_mat(truth, predicted) |>
  autoplot(type = "heatmap") +
  scale_fill_continuous_sequential(palette = "Blues") +
  theme(text=element_text(family = "serif", size=15), 
        axis.text.x = element_text(colour="black"), 
        axis.text.y = element_text(colour="black"))

image

It would be much better if the output is rendered in the following way

image

bappa10085 avatar Aug 02 '24 05:08 bappa10085