Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
189 views
in Technique[技术] by (71.8m points)

python - Replicate PNG chart in Plotly

Could someone please help me in converting the below bar chart created in matplotlib to plotly with labels appearing on hover.

df_scaled is the dataset name and selected_columns is the list of variables and kmeans is the predicted output

# Plot data
tidy = df_scaled[selected_columns+['kmeans']].melt(id_vars='kmeans')
fig, ax = plt.subplots(figsize=(15, 5))
sns.barplot(x='kmeans', y='value', hue='variable', data=tidy, palette='Set3')
plt.legend(loc='upper right')
#plt.savefig('randomforest.jpg', dpi=300)
plt.savefig("Clustering_Restricted_features.jpg", dpi=300)

Please find the attached image of the plot for the above code enter image description here

The ultimate aim here is to make the chart interactive with labels on hover using plotly.

question from:https://stackoverflow.com/questions/65876659/replicate-png-chart-in-plotly

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...