I want to draw the median segments in geom_boxplot()
with custom colors. I found a solution for R-ggplot2 with gg_build()
which provides x
, xend
, y
, yend
inputs for geom_segment()
to overlay the median segments on the boxplot.
I couldn’t find gg_build()
equivalent functionality in plotnine, so my approach is to construct a new dataframe which calculates these 4 values for each group, needed by geom_segment
.
To that end, I know how to get y
and yend
for each group – these values are the group medians. However, not clear on how to calculate x
and xend
? Since I need to find a x-value for each group (for my use-case, groups names are str
type). Additionally, I also require the box-width used in geom_boxplot()
.
Any suggestions on how to extract/calculate those?
Thanks!