Hi!
Iโm following this tutorial: PCA Visualization | Python | Plotly
I use the following code:
pca = PCA(n_components=2)
components = pca.fit_transform(X)
colorsIdx = {'0': 'blue', '1': 'yellow'}
fig = px.scatter(components, x=0, y=1, color=df_stimuli['is_500_days'],
labels={'0': 'PC 1', '1': 'PC 2'})
fig.update_layout(title_text=f'{brain_area}', title_x=0.5)
fig.show()
But instead of a legend with 2 classes (in my case the column df_stimuli[โis_500_daysโ] contains only 0โs and 1โs) it creates a colorbar.
If I add
fig.update(layout_coloraxis_showscale=False)
fig.update(layout_showlegend=True)
It removes the colorbar, but no legend is shown.