Skip to content

Legend size overridden by subgroup border #36

@dekaufman

Description

@dekaufman

Code example, using theme() to control the size and shape of the legend key items:

library(treemapify)

plot_11 <- ggplot(diamonds %>% head(12), 
                     aes(area = carat, fill = color, label = color, 
                         subgroup = cut, subgroup2 = color)) +
  geom_treemap(size = 3) +
  # geom_treemap_subgroup_border(color = "grey", size = 20) +
  geom_treemap_subgroup2_border(color = "grey", size = 2) +
  geom_treemap_subgroup_text(place = "center", grow = FALSE, alpha = 0.5, colour =
                               "black", fontface = "italic", min.size = 2,
                             padding.x = grid::unit(3,"mm"), padding.y = grid::unit(3,"mm") ) +
  theme(legend.key.size = unit(1, "cm"), 
        legend.key.width = unit(0.3, "cm")) +
  theme(legend.background = element_rect(fill = 'grey'))
plot_11

Result:
image

However, when geom_treemap_subgroup_border() is uncommented to introduce some separation between major groupings, the legend key sizing no longer works:
image

(Actually, it partly works. Values of legend.key.size bigger than 2 cm will take effect.)

Is there a way to use both features fully?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions