Skip to content
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

How to sort columns after col_split #81

Open
stephanmg opened this issue Jul 17, 2024 · 11 comments
Open

How to sort columns after col_split #81

stephanmg opened this issue Jul 17, 2024 · 11 comments

Comments

@stephanmg
Copy link

stephanmg commented Jul 17, 2024

Hi,

I have a col_split by a pd.Series to group into 3 different groups A, B, and C.

The groups A, B, C seem to be automatically sorted ascending.

However I need to sort with a custom order within the groups A, B, C. How is this possible?

@DingWB
Copy link
Owner

DingWB commented Jul 17, 2024

@stephanmg
Copy link
Author

Yes, I forgot that I need to also specify col_cluster=False, col_dendrogram=False is not enough.

@stephanmg
Copy link
Author

stephanmg commented Jul 18, 2024

@DingWB thank you! Is it also possible to remove or reposition the label of a anno_barplot(...)?

Code:
AB=anno_barplot(....

I need to move the label AB or remove it in the plot.

Remove label with label_kws: 'visible': False. Can I also move the label more away from the plot?

Also, how can i provide a label to anno_barplot which contains spaces, in the examples in the docs there are never spaces I think, is this perhaps not supported? I need to write AB variant=anno_barplot(...) in essence.

@stephanmg stephanmg reopened this Jul 18, 2024
@DingWB
Copy link
Owner

DingWB commented Jul 18, 2024

How did you control the pad in a normal barplot?
You can control the pad similarly by taking the ax of the anno_barplot and doing whatever you want.

@stephanmg
Copy link
Author

Thanks, what about the label name? Can I somehow include spaces?

@DingWB
Copy link
Owner

DingWB commented Jul 18, 2024

Please try.

@stephanmg
Copy link
Author

No, sorry, I mean in the labels name. This is a second question, on how to rename the label, e.g. AB for the annotation to AB variant`

@DingWB
Copy link
Owner

DingWB commented Jul 18, 2024

See this docu: https://dingwb.github.io/PyComplexHeatmap/build/html/notebooks/advanced_usage.html#Add-multiple-heatmap-annotations-using-for-loop

You could prepare a dict and pass it to HeatmapAnnotation. You can give whatever key to the dict (including space).

@stephanmg
Copy link
Author

legend_kws with label I assume? doesn't work somehow for my anno_barplot. :/

@stephanmg
Copy link
Author

row_ha = HeatmapAnnotation(ABadvanced=anno_barplot(histo_data_for_row_ha, colors=bar_color, height=15), verbose=0, label_kws={'label': "# problems solved", 'rotation':0, 'fontsize': 8, 'horizontalignment':'left','verticalalignment':'bottom', 'visible':False}, axis=1)

@stephanmg
Copy link
Author

stephanmg commented Jul 19, 2024

But this will not rename Abadvanced to "# problems solved"... don't know why. Could you help out again? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants