grantmcdermott / tinyplot

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

Support area plot types #69

Closed grantmcdermott closed 1 year ago

grantmcdermott commented 1 year ago

Closes #67.

(I also fixed a bug related to bespoke legends when passing to plot2.density via the one-sided formula method... but that's supplemental to the main purpose of the PR.)

Some quick examples.

devtools::load_all("~/Documents/Projects/plot2")
#> ℹ Loading plot2

plot2(sin(seq(0,10, .1)), type = "area")


plot2(mpg ~ wt, mtcars, type = "area")

And then some fancier examples because we can (TM).


par(las = 1)

plot2(
    ~Temp, airquality,
    type = "area",
    col = "darkcyan",
    grid = TRUE, frame = FALSE
)


plot2(
    ~ Temp | Month, airquality,
    type = "area",
    grid = TRUE, frame = FALSE
)

grantmcdermott commented 1 year ago

Merging this myself as the core change (lines 359-364) is very simple.

vincentarelbundock commented 1 year ago

Those examples are killer