Closed KyleKing closed 6 years ago
Set colour = black
in geom_treemap
:
ggplot(G20, aes(area = gdp_mil_usd, fill = region, label = country)) +
geom_treemap(colour = "black") +
geom_treemap_text(grow = T, reflow = T, colour = "black")
Putting colour = "black"
inside aes
doesn't work because aes
is for mapping plot aesthetics to data variables, not for setting plot aesthetics to a fixed value. If you map the colour aesthetic to a single string 'black' (or any string for that matter), it's as if you've created a new column in your input data frame that just contains the value 'black' for all rows, and mapped the colour aesthetic to this column. ggplot2 will draw the variable with the default colour scale, which happens to have that pale red colour as its first value, which is why in your example the lines were drawn red.
Thank you!!
Is it possible to modify the color of the intra-group border color (not the geom_treemap_subgroup_border)? I would like a color that has higher contrast than the default gray so it will be more visible on a projector display
I tried setting the colour parameter in the aes argument, but the lines become red instead.
I just started working with R, but does this snippet overwrite the color?
https://github.com/wilkox/treemapify/blob/c859bc30ecc4cf283248369898599a6451456e1d/R/geom_treemap.R#L143-L157