Open luisesanmartin opened 3 years ago
Something like this: https://www.r-graph-gallery.com/136-stacked-area-chart.html
What I mean is not actually density plots, but stacked area plots
Hi @luisesanmartin , were you thinking of something like this?
yes. The areas should be stacked against each other and not overlapping. In this example, I would understand that the data has ~600 obs with NA and 0 active years, ~50 women with 0 active years, and ~600 men with 0 active years. Is that the case?
yes, that's right.
thanks, then this is what I suggested indeed
gender_colors <- c("#F4BA3B", "#730B6D")
gender %>%
ggplot() +
geom_area(aes(x = founded,
y = n_gender,
fill = gender)) +
labs(x = "Year firm was founded",
y = "Number of firms",
title = "Year firm was founded, by gender of leaders") +
scale_fill_manual(values = gender_colors,
na.value = "gray") +
theme_classic() +
theme(
legend.position = 'top',
legend.title = element_blank(),
plot.title = element_text(hjust = 0.5),
axis.line = element_blank(),
axis.ticks = element_blank(),
panel.grid.major = element_line()
)
I received an email from one of the attendants of the R course asking if we had an example like this in the visual library. She was asking for something similar to this, but with the densities stacked one against the other instead of overlapping