You are right, itβs quite cumbersome. What one had to figure out, how the dataframe has to be structured for your visualization goals. But in the end: you already did it!? You could just convert it to a function if your df always looks like this.
dataframe
df
Concerning the comment of matching colors: