I couldn't find what I want, the best I've done is to limit the axis y
This I the code:
p1 <- explore_data %>%
ggplot(aes(nosis_worst_situation, fill=target)) +
ggtitle("\n Histogram") +
theme(plot.title = element_text(hjust = 0.5),
legend.position="none") +
geom_bar(stat='count', position = 'stack') +
geom_text(aes(label=..count..),
stat='count',
size = 2) +
facet_grid(is_for_train~.) +
scale_x_continuous(breaks = c(0,1,2,3,4,5))
p2 <- explore_data %>%
ggplot(aes(x=nosis_worst_situation, fill=target)) +
facet_grid(is_for_train~.) +
ggtitle("\n Percent Stacked Bar Chart") +
theme(plot.title = element_text(hjust = 0.5),
legend.text=element_text(size=14)) +
geom_bar(stat='count', position = 'fill') +
scale_y_continuous(labels = scales::percent, limits = c(0, 0.3)) +
scale_x_continuous(breaks = c(0,1,2,3,4,5))
options(repr.plot.width=12, repr.plot.height=4)
grid.arrange(p1, p2, nrow = 1)