Skip to content

Commit e327a5e

Browse files
authored
Guide custom order (#6199)
* apply order * add news bullet
1 parent aa6ee95 commit e327a5e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@
268268
aesthetics (@teunbrand, #2800).
269269
* Stricter check on `register_theme_elements(element_tree)` (@teunbrand, #6162)
270270
* Added `weight` aesthetic for `stat_ellipse()` (@teunbrand, #5272)
271+
* Fixed a bug where the `guide_custom(order)` wasn't working (@teunbrand, #6195)
271272

272273
# ggplot2 3.5.1
273274

R/guides-.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,9 @@ Guides <- ggproto(
306306
return(no_guides)
307307
}
308308

309-
guides$guides <- c(guides$guides, custom$guides)
310-
guides$params <- c(guides$params, custom$params)
309+
ord <- order(c(names(guides$guides), names(custom$guides)))
310+
guides$guides <- c(guides$guides, custom$guides)[ord]
311+
guides$params <- c(guides$params, custom$params)[ord]
311312

312313
guides
313314
},

0 commit comments

Comments
 (0)