Skip to content

Non-sensical scaling for plots #894

@profandyfield

Description

@profandyfield

I quite often come across plots from check_model() where the y-axis is scaled ludicrously (presumably because of the loess function creating a curve that is wildly curved). This code breaks reprex() but gives an example:

library(performance)
library(see)
library(ggplot2)
# remotes::install_github("profandyfield/discovr")

display_tib <- discovr::display

fb_glm <- glm(display ~ fb, family = binomial(), data = display_tib)
check_model(fb_glm, check = "outliers")

The obvious solution in these cases is to explore the residuals/influence stats more manually, or adjust the scales manually with sopmething like

fb_resid <- check_model(fb_glm, check = "outliers")
fb_gg <- plot(fb_resid)
fb_gg[[1]] + coord_cartesian(ylim = c(-4, 4))

but from a teaching perspective it's a bit of a nightmare - you just want students to see plots they can say something sensible about.

Is there a way to limit to the scaling to sensible maximum/minimum values? I've seen this behaviour with the homoscedasticity plots too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions