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 user-supplied polygons #127

Closed grantmcdermott closed 7 months ago

grantmcdermott commented 7 months ago

Closes #126.

Have been meaning to add this to open up the door for spatial support... But actually prompted by @eddelbuettel (and implicitly @kjhealy) nerd-sniping me. https://bsky.app/profile/eddelbuettel.com/post/3klf4t4musj2y

Happy Valentine's Day, folks!

pkgload::load_all("~/Documents/Projects/tinyplot")
#> ℹ Loading tinyplot

i = seq(0, 2*pi, by = 0.01)
x = 16*sin(i)^3
y = 13*cos(i) - 5*cos(2*i) - 2*cos(3*i) - cos(4*i)

plt(
  x, y,
  type = "polygon",
  col = "red", fill = adjustcolor("firebrick", 0.8),
  axes = FALSE, xlab = NA, ylab = NA
)

Created on 2024-02-14 with reprex v2.1.0