I would like to create a tornado plot using seaborn objects and was wondering if there was an efficient way to do this.
import numpy as np
import pandas as pd
import seaborn.objects as so
# create a dataframe with the columns id, gender, and age with random values
df = pd.DataFrame({'id':np.random.randint(0, 1000, 100), "gender":np.random.choice(['m', 'f'], 100), "age":np.random.randint(18, 100, 100)})
so.Plot(data=df, x="age", y='id', color='gender').add(so.Bars(), so.Hist(), so.Stack())
This code generates a stacked histogram that looks similar to this:
Now rather than having the bars stacked I would like to have one color on the positive axis and the other on the negative axis. Is there a way to get there without having to create two plots and gluing them together?
I understand that maybe there is not, because the solution would not be generic to any number of different items in the gender column, but then again, maybe there is.

df.loc[df.gender.eq('m'), 'id'] = df.loc[df.gender.eq('m'), 'id'].mul(-1)andso.Plot(data=df, x="age", y='id', color='gender').add(so.Bars())df['age range'] = pd.cut(df.age, bins=range(10, 110, 10)),df.loc[df.gender.eq('m'), 'id'] = df.loc[df.gender.eq('m'), 'id'].mul(-1),dfg = df.groupby(['age range', 'gender'])['id'].sum().reset_index(),so.Plot(data=dfg, x="age range", y='id', color='gender').add(so.Bars())