Closed grantmcdermott closed 1 year ago
Reopening since grouped ribbons still aren't working unless manually ordered beforehand.
pred = predict(lm(mpg~wt+factor(cyl),mtcars), interval = "confidence")
m = cbind(mtcars, pred)
library(plot2)
with(
m,
plot2(wt, fit, ymin = lwr, ymax = upr, by = cyl, type = "ribbon")
)
with(
m[order(m$wt),],
plot2(wt, fit, ymin = lwr, ymax = upr, by = cyl, type = "ribbon")
)
Created on 2023-08-09 with reprex v2.0.2
Fixed with https://github.com/grantmcdermott/plot2/commit/b0bcb94fae07dc3ad50d4a3e24a5f96e46d65ad9
pred = predict(lm(mpg~wt+factor(cyl),mtcars), interval = "confidence")
m = cbind(mtcars, pred)
library(plot2)
with(
m,
plot2(wt, fit, ymin = lwr, ymax = upr, by = cyl, type = "ribbon")
)
Created on 2023-08-09 with reprex v2.0.2
Ribbons only make sense in the context of ordered data. So something like the following should work automatically.
Created on 2023-08-07 with reprex v2.0.2