Sort y axis for traces (part of a figure)

Thanks @farispriadi for helping out. I also specified the y-axis range, by getting the category and min/max of the year, such as

y_axis_order= []
category_order= df['category'].dropna().unique().tolist()
category_order.sort()
y_axis_order += category_order

min_year = df['selection'].min()
max_year = df['selection'].max()
year_order = [str(year) for year in range(int(min_year), int(max_year))]
y_axis_order += year_order 

and then update the y-axis using this list fig.update_yaxes(categoryorder='array', categoryarray=y_axis_order ), this makes the portion that shows the year ticks (selection) take much of the space and squeeze the A/B/C, etc… (category) portion.

Is it then possible to adjust the height separately, or for example have them take up 2:1 ratio space respectively?

Edit: I guess this follow-up question took on another direction; i have opened up another post here instead. Thanks so far! :smile:

1 Like