I would like to add curly braces to a plotnine plot to highlight a feature.
At the moment I an annotating a '}'
onto the plot, but in order to get it the right width, the brace is far too fat. This is also not scalable should I want it to expand to more than one group, and ideally it would be possible to control depth/width, and thickness etc.
Is it possible to add curly braces to a plotnine plot?
The below plot shows what I am trying to achieve.
import pandas as pd
from plotnine import *
df = pd.DataFrame({
'Group':('Group1',)*6 + ('Group2',)*6,
'AgeRange':(6,5,4,3,2,1)*2,
'Mean':(1,3,5,7,9,11,2,4,6,8,10,12)
})
p = (ggplot(df,aes(x='AgeRange', y='Mean', fill='Group'))
+ theme_minimal()
+ geom_col(position='dodge', width=0.8)
+ coord_flip()
+ annotate('text', x=5, y=4.65, label='}', size=32)
+ annotate('text', x=5, y=5, label='Something pithy...', size=10, ha='left')
)
p