# if categorical variables exist, add 2 select lists to choose the categorical variables to color the PCA
ifcat_cols[0]=="no categories":
plot_pc=scatter_column.plotly_chart(px.scatter(data_frame=pc_data,x=pc_1,y=pc_2,template="simple_white",height=800,hover_name=pc_data.index,title="PC plot of sample spectra"))
plot_pc=scatter_column.plotly_chart(px.scatter(data_frame=pc_data,x=pc_1,y=pc_2,template="simple_white",height=800,color=categorical_variable,hover_data=[categorical_variable_2],hover_name=pc_data.index,title="PC plot of sample spectra"))
# if categorical variables exist, add 2 select lists to choose the categorical variables to color the PCA
ifcat_cols[0]=="no categories":
plot_pc=scatter_column.plotly_chart(px.scatter(data_frame=pc_data,x=pc_1,y=pc_2,template="simple_white",height=800,hover_name=pc_data.index,title="PC plot of sample spectra"))
plot_pc=scatter_column.plotly_chart(px.scatter(data_frame=pc_data,x=pc_1,y=pc_2,template="simple_white",height=800,color=categorical_variable,hover_data=[categorical_variable_2],hover_name=pc_data.index,title="PC plot of sample spectra"))
# Clustering method
cluster_type=['','k-means']
# cluster_type = ['k-means', 'umap'] # uncomment if more clustering algorithms available
# plot de pc with colored clusters and selected samples
graph_selected=px.scatter(data_frame=pc_data,x=pc_1,y=pc_2,template="simple_white",height=800,color=kmeans_samples.labels_,hover_name=pc_data.index,title="PC projection with K-Means Clusters and selected samples")
plot=scatter_column.plotly_chart(graph_selected)
# button to export the names of selected samples - by cluster if random - in a csv
# plot de pc with colored clusters and selected samples
graph_selected=px.scatter(data_frame=pc_data,x=pc_1,y=pc_2,template="simple_white",height=800,color=kmeans_samples.labels_,hover_name=pc_data.index,title="PC projection with K-Means Clusters and selected samples")
plot=scatter_column.plotly_chart(graph_selected)
# button to export the names of selected samples - by cluster if random - in a csv