My input:
df=(pd.DataFrame({'label_color':['white','white','cyan','cyan','cyan','cyan','white','white'],
'label_quality':['white','white','red','green','green','red','white','white'],
'label':['foo','foo','foo','foo','foo','foo','foo','foo']}))
Let me explain what I want: "One column" will be label color and "Second column" will be label_quality, where x.axis is df.index and correlated position columns with order of index. Also y.axis is just name of label. And colors is values from df columns["label_colors ","label_quality"]
Here solution that provide @r_beginners:
df['color_value'] = 1
df['quality_value'] = 1
fig = px.bar(df, y=['color_value','quality_value'],
x=[1]*len(df),
orientation='h',
barmode='group',
template='plotly_white')
fig.data[0]['marker']['color'] = df['label_color'].tolist()
fig.data[1]['marker']['color'] = df['label_quality'].tolist()
fig.update_traces(marker_line_color='rgb(8,48,107)')
fig.update_layout(showlegend=False, yaxis_title='foo', xaxis_title='')
fig.show()
But ion real data its looks some strange:
seems like that column borders overlapped:
I find solution: fig.update_traces(marker_line_color='rgb(255,255,255)', marker_line_width=0 )
So:
Hope it will be helpful anyone who want visualization data



