Closed zhaouu closed 7 years ago
I don't know what your data should look like, so just saying it's "not showing correctly" and then adding a screenshot does not help me diagnose the problem. What exactly is the issue?
Thanks for your reply. I used matplotlib plotted the color list. It showed correctly. My command line is:
In [471]: plt.vlines(range(len(colors)),ymin=0,ymax=1,color=colors)
In [472]: plt.show()
··· In [473]: colors.head() Out[473]: 60617173 white 60617274 white 60617317 white 60617384 white 60617447 white Name: , dtype: object ··· You can see the background color is white, and I marked some region. But in the heatmap, the background color become to orange, and marked region can't show completely. Is this because the columns is very large(In my data is 6027 columns)? I think it is a bug of clustermap. Hope for your reply.
I'm sorry but I cannot help you without a reproducible example.
Here is my test data, Thank you very much!
data = dd.T.head()
f= open('test_data.pickle','wb')
pickle.dump([data, colors], f)
zip test_data.zip test_data.pickle
Please do not share data as a pickle. It is insecure. If I were to load your dataset, it could execute arbitrary code on my system. The common format for sharing Pandas DataFrames is .csv
.
OK, I converted it to csv fomat. test_data.zip
Your problem is using the keyword robust
, which is interfering with the assignment of colors:
df = pd.read_csv("test_data.csv", index_col=0)
df.columns = df.columns.astype(int)
colors = pd.Series.from_csv("colors.csv")
g = sns.clustermap(df, col_cluster=False,
metric='correlation',
col_colors=colors, linewidths=0,
yticklabels=False, xticklabels=False,
robust=False)
As a note for future interactions with open source projects, it took me quite a bit of time to reconstruct your issue once you shared the data. In the future you should share a self-contained, reproducible example of the problem. That would be a script that I could copy and paste and immediately see the plot that you have. If you are asking people for free technical support, you should put in the effort to make it easy as possible for them to help you.
My clustermap can't show col_colors correctly:
but my plot is like this: