I read many posts similar to my questions but for some reasons they still don't work. I'm working on the well known plotly database 'tips'. I want to show 2 subplots by 'sex' and then edit both subplots' titles. I start from this code:
df=px.data.tips()
names={'Femmine':'Plot1','Maschi':'Plot2'}
fig=px.box(df,x='day',y='tip',facet_col='sex')
Now I'd like to edit the default subtitles outcome('sex=Female', 'sex=Male') and replace them with two names i stored in the dictioanry names. I tried this:
fig.for_each_annotation(lambda a: a.update(text=str(names.keys())))
fig
But the output gives me this:
Really, i know the solution is there but ...I simply can't find it. Any help? Thanks