grantmcdermott / tinyplot

Lightweight extension of the base R graphics system
https://grantmcdermott.com/tinyplot
Apache License 2.0
208 stars 7 forks source link

Support add=TRUE #60

Closed grantmcdermott closed 11 months ago

grantmcdermott commented 11 months ago

Closes #55. Simplifies things by ignoring the legend for any added elements. (Maybe we can revisit down the line.)

Simple penguins example.

library(plot2)
par(pch = 15)

data(penguins, package = "palmerpenguins")

plot2(bill_depth_mm ~ bill_length_mm | species, penguins, pch = "by", grid = TRUE)

penguins$pred = predict(lm(bill_depth_mm ~ bill_length_mm * species, penguins), newdata = penguins)

plot2(pred ~ bill_length_mm | species, penguins, type = "l", add = TRUE)

Created on 2023-08-13 with reprex v2.0.2