how do I add curly brackets outside of ggplot??

Would anyone know/be able to direct me to good source on how to add brackets to image 2 to mimic image 1?

Image 1:

Image 2:

area_fig <- ggplot(df_long, aes(x = year, y = index, fill = topics2)) + 
  geom_area() +
  theme_classic() +
  xlab("\nYear") +
  ylab("Index\n") +
  scale_x_continuous(breaks = seq(1970,2017,2)) +
  scale_y_continuous(breaks = seq(0.00,1.00,0.1)) +
  theme(axis.text.x=element_text(angle = 45, hjust = 1)) +
  labs(fill = 'Topics') +
  scale_fill_manual(values = c("lightgrey", "grey",                                                                # G
                                            "#ccfefe", "#ccfe99",                                                  # F
                                            "#c905fb", "#714299",                                                  # E
                                            "#f9fcd0", "#f0f920", "#fec81f", "#fe9b2d", "#fe3502",                 # D 
                                            "#DAF2C7", "#99ff99", "#66ff33", "#33cc33", "#669900", "#336600",      # C                                
                                            "#9dc3e6", "#4777ef"      ,                                            # B
                                            "#fbe1e5", "#f4b2bb", "#ff7c80", "#ff4747", "#ff0000", "#a8041b")) +   # A    
  theme(legend.title = element_text(size = 7),
        legend.key.size = unit(0.3, 'cm'), 
        legend.key.height = unit(0.3, 'cm'),
        legend.key.width = unit(0.3, 'cm'),
        legend.position = 'right',
        legend.text=element_text(size = 6.5),
        legend.text.align = 0) +
  scale_y_continuous("",breaks=c(0.8, 1.0), labels = "High types" ) 
  
print(area_fig)

I think the lemon package could do this potentially. thought style wise its brackets are square not curly.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.