I have a dataset that looks as follows:
df = pd.DataFrame({"Sunday": {'a1':0.1,'a2':0.15,'a4':0.05,'a6':0.1,'b2':0.05,'b3':0.05,'b4':0.2,'c1':0.15,'c4':0.15},
"Monday": {'a2':0.05,'a3':0.15,'a5':0.25,'b1':0.05,'b3':0.1,'b4':0.1,'c3':0.1,'c5':0.05,'c7':0.15},
"Tuesday": {'a1':0.2,'a3':0.15,'a6':0.05,'b2':0.35,'b3':0.05,'c1':0.1,'c4':0.1},
"Wednesday": {'a2':0.05,'a3':0.05,'a4':0.35,'a6':0.2,'b1':0.1,'b3':0.05,'b4':0.05,'c1':0.05,'c6':0.1},
"Thursday": {'a1':0.25,'a3':0.05,'a4':0.3,'a5':0.05,'a6':0.1,'b1':0.05,'b4':0.05,'c2':0.1,'c4':0.05},
"Friday": {'a1':0.1,'a2':0.15,'a5':0.1,'a7':0.05,'b2':0.05,'b1':0.15,'b4':0.2,'c3':0.05,'c4':0.05,'c5':0.05,'c7':0.05},
"Saturday": {'a1':0.15,'a3':0.05,'b2':0.05,'b3':0.05,'b4':0.4,'c1':0.1,'c5':0.1,'c7':0.1}
}}
The keys in dictionaries for each day are categorical and they come in three general types a, b, c: each of them having some number of sub-types. There are 6 subtypes in a-type, 4 subtypes in b-type and 7 subtypes in c-type. The values in dictionaries, represent weights (importance). Not every observation (day), needs to have all possible sub-types present. Nan values in each observation (day) should be ignored (when plot is created).
I would like to visualize this data using a discrete colormap, similarly as it was done in this post: heatmap-like plot, but for categorical variables in seaborn. Their solution is very elegant but my problem is slightly more complicated, as I would also like to reflect the weight of each subtype—by the height of the rectangle that represents it (shown on y-axis). Weights for each day always sum to one. On the x-axis, I would like to have weekdays shown. And all subtypes with colors assigned to them should be shown on the colorbar on the right with their corresponding code names: 'a1',...,'a6', 'b1', ...,'b4','c1',...,'c7'.
Finally, I would like to use different colormaps to color different subtypes: for example, blues for a-types, greens for b-types and reds for c-types.
I would like to do this using Python Seaborn package but if you can suggest a better solution using a different package I don't mind using it instead.
I would appreciate any suggestions. Thank you.