I have two plots based on two different features. I want to "superimpose" the two plots to show the effect of tumor subtypes (kirp
, kirc
, kich
) on survival (lts
, non-lts
).
import pandas as pd
import plotly.express as px
import numpy as np
from sklearn.decomposition import KernelPCA
# Data
X = meth_clin_sub_nt_2_kipan.iloc[:,7:-1]
# Kernel PCA
kpca = KernelPCA(n_components=2, kernel='rbf',
gamma=15, random_state=42)
X_kpca = kpca.fit_transform(X)
# Survival plot
fig = px.scatter(X_kpca, x=0, y=1, color=meth_clin_sub_nt_2_kipan["survival"], width=600, height=600, title="Kernel PCA - Survival", symbol=meth_clin_sub_nt_2_kipan["survival"], symbol_sequence=['circle','square'])
fig.update_xaxes(automargin=True)
fig.update_yaxes(automargin=True)
fig.update_layout({'plot_bgcolor': 'rgb(240,240,240)','paper_bgcolor': 'rgb(240,240,240)'})
fig.show()
# Tumor subtype vs normal plot
fig = px.scatter(X_kpca, x=0, y=1, color=meth_clin_sub_nt_2_kipan["type"], width=600, height=600, color_discrete_sequence=["red", "orange", "brown", "green"], title="Kernel PCA - tumor subtype vs normal", symbol=meth_clin_sub_nt_2_kipan["type"], symbol_sequence=['circle','circle','circle','square'])
fig.update_traces(marker=dict(size=5,line=dict(width=0.5,color='DarkSlateGrey')),selector=dict(mode='markers'))
fig.update_xaxes(automargin=True)
fig.update_yaxes(automargin=True)
fig.update_layout({'plot_bgcolor': 'rgb(240,240,240)','paper_bgcolor': 'rgb(240,240,240)',})
fig.show()