Skip to content

Commit

Permalink
ggfree: add .names column
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Jan 5, 2025
1 parent 6e27b41 commit b686b2f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/ggfree.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ FreeGg <- ggproto("FreeGg", AlignProto,
layout_data <- layout@data
if (is.waive(input_data <- self$input_data)) { # inherit from the layout
data <- layout_data
self$labels <- vec_names(layout_data)

# for data inherit from the layout, and the design is for discrete
# variable, we'll integrate the design into the plot data
self$use_design <- is_stack_layout(layout)
Expand Down Expand Up @@ -138,7 +140,8 @@ FreeGg <- ggproto("FreeGg", AlignProto,
if (isTRUE(self$use_design) && is_discrete_design(design)) {
plot_data <- data_frame0(
.panel = .subset2(design, "panel"),
.index = .subset2(design, "index")
.index = .subset2(design, "index"),
.names = .subset(self$labels, .subset2(design, "index"))
)
if (!is.null(extra_plot_data)) {
plot_data <- cross_join(plot_data, extra_plot_data)
Expand Down

0 comments on commit b686b2f

Please sign in to comment.