Organize bar by qualitative variable in go.Bar

I am attempting to color the bars in a bar chart by the dependent variable. The same data i am using is just the iris set.

The documentation states that the “marker” property is available for go.Bar. However, when I add this in, it doesnt change the color.

But it doesn’t throw an error, either.

Does anyone have any ideas on how to color the bars by the y axis?

def bar_overview(df, dependent,max_cols=4):
    
    max_rows=ceil(float(len(df.columns)/max_cols))
    
    fig = make_subplots(
        rows=max_rows, 
        cols=max_cols,
        subplot_titles=df.drop([dependent], 1).columns).update_layout(
        {"title":"bar of features, by dependent variable"})
    
    col_cyc = cycle(iter(range(1,max_cols+1)))
    
    color_list = px.colors.qualitative.T10
    row=1
    
    for j in df.drop([dependent], 1).columns:
        col=next(col_cyc)
        gb_mean = df.groupby([dependent]).agg({j: "mean"})
        fig.add_bar(
            x=gb_mean.index.astype(str), 
            y=gb_mean[j], 
            row=row,
            col=col,
            name=j,
            
            marker={"colorscale": color_list},
            #color=gb_mean.index.astype(str),
            #color_discrete_sequence=colors      
        )

        if col % max_cols == 0:
            row+=1
        col+=1
        
    print(color_list)
        
    return fig

bar_overview(df, "class", 2)

The output is shown here

And what I would like to recreate is for example something like this

Note: please ignore the # of charts, typing from my phone.

Solved. x and y had to be accessed a different way; essentially looping thru each bar value.

# loop thru cols with j, for multiple graphs
        for cat in df[sliceable].unique(): # loop thru each attribute of the variable df[col]
            fig.add_bar(
                x = [cat],
                y = [df[j][df[sliceable]==cat].mean()],
                row=row, 
                col=col, 
                name=j,
                marker={"color": next(color_list)},
                showlegend=False
                
            )