Skip to content

Commit

Permalink
ensure that draw_axis() works with element_text() subclasses (#3381)
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot authored Jun 24, 2019
1 parent 1ae034e commit e2bdf85
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions R/guides-axis.r
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ draw_axis <- function(break_positions, break_labels, axis_position, theme,

# override label element parameters for rotation
if (inherits(label_element, "element_text")) {
label_element <- merge_element(
axis_label_element_overrides(axis_position, angle),
label_element
)
label_overrides <- axis_label_element_overrides(axis_position, angle)
# label_overrides is always an element_text(), but in order for the merge to
# keep the new class, the override must also have the new class
class(label_overrides) <- class(label_element)
label_element <- merge_element(label_overrides, label_element)
}

# conditionally set parameters that depend on axis orientation
Expand Down

0 comments on commit e2bdf85

Please sign in to comment.