|
# Adjust the x transformation based on the number |
|
# of dodge variables |
|
dvars = {'alpha', 'colour', 'fill', 'linetype', |
|
'shape', 'size', 'stroke'} |
|
dodge_columns = data.columns.intersection(dvars) |
|
if len(dodge_columns) == 0: |
|
raise PlotnineError( |
|
"'position_jitterdodge' requires at least one " |
|
"aesthetic to dodge by.") |
(
ggplot(df, aes(x='x_val', y='y_val', color='device'))
+ geom_boxplot()
+ geom_jitter(position=position_jitterdodge())
)
The code works fine when using geom_dodge:
(
ggplot(df, aes(x='x_val, y='y_val, color='device'))
+ geom_boxplot()
+ geom_jitter(position=position_dodge(0.75))
)

plotnine/plotnine/positions/position_jitterdodge.py
Lines 50 to 58 in 90412f4
The code works fine when using geom_dodge: