grantmcdermott / tinyplot

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

Facet titles are not sorted correctly #95

Closed grantmcdermott closed 5 months ago

grantmcdermott commented 5 months ago

... leading to wrong titles above the different facet plots. (If the data are not already sorted by the facet variable(s).)

library(plot2)
library(ggplot2) ## for comparison

with(mtcars, plot2(x = wt, y = mpg, facet = cyl))

Note the "6" and "4" facet titles should be swapped.

Compare:


ggplot(mtcars, aes(x = wt, y = mpg)) +
  geom_point(shape = 1) + 
  facet_wrap(~cyl) + 
  theme_linedraw() +
  theme(panel.grid = element_blank())

Created on 2024-01-21 with reprex v2.0.2

A bad bug, but a simple thing to fix. PR incoming shortly.