-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
legend not show #98
Comments
I ran the same code, and everything is good. |
The same issue as @wahaha233333, I didn't see the legend with the code above.
|
Hi @winglet0996 |
Please let me know whether it works or not @wahaha233333 @winglet0996 |
That helps! Thanks a lot for your quick reply. |
It works!, thank you so much. |
I have a related issue I think. I cannot see the bottom of the plots and I need to keep changing the figure size to see the legend using the code in https://dingwb.github.io/PyComplexHeatmap/build/html/notebooks/get_started.html#2.-Plot-heatmap-annotations Version 1.8.1.post2 figsize = 3,4 (exact example code) increase width (8,4) => can start to see the legend but the image is now scaling as well |
You ran the code in Pycharm or Jupiter? |
Pycharm equivalent - macOS using venv. I used the codeblock [11] in this example: https://dingwb.github.io/PyComplexHeatmap/build/html/notebooks/get_started.html#2.-Plot-heatmap-annotations Version 1.8.1.post2 |
What if you save it to a PDF? |
Please try |
df = pd.DataFrame(['GroupA'] * 5 + ['GroupB'] * 5, columns=['AB'])
df['CD'] = ['C'] * 3 + ['D'] * 3 + ['G'] * 4
df['EF'] = ['E'] * 6 + ['F'] * 2 + ['H'] * 2
df['F'] = np.random.normal(0, 1, 10)
df.index = ['sample' + str(i) for i in range(1, df.shape[0] + 1)]
df.head()
df_heatmap = pd.DataFrame(np.random.randn(30, 10), columns=['sample' + str(i) for i in range(1, 11)])
df_heatmap.index = ["Fea" + str(i) for i in range(1, df_heatmap.shape[0] + 1)]
df_heatmap.iloc[1, 2] = np.nan
plt.figure(figsize=(3.5, 6))
cm = pch.ClusterMapPlotter(data=df_heatmap,
col_cluster=True,row_cluster=True,
col_split=df.AB,row_split=2,
col_split_gap=0.5,row_split_gap=0.8,
label='values',row_dendrogram=True,
show_rownames=True,show_colnames=True,
row_names_side='right',
tree_kws={'row_cmap': 'Set1','colors':'blue'},verbose=0,legend_gap=5,
cmap='RdYlBu_r',xticklabels_kws={'labelrotation':-90,'labelcolor':'blue'})
plt.savefig("example0.pdf", bbox_inches='tight')
plt.show()
version: 1.7.9
python: 3.11.0
matplotlib: 3.9.2
this is what i got
The text was updated successfully, but these errors were encountered: