enblacar / SCpubr

Generate high quality, publication ready visualizations for single cell transcriptomics data.
https://enblacar.github.io/SCpubr-book/
GNU General Public License v3.0
157 stars 12 forks source link

How to manually edit the complexHeatmap parameters after generating the heatmap? #40

Closed kaizen89 closed 1 year ago

kaizen89 commented 1 year ago

Hi, I made a heatmap with do_ExpressionHeatmap as following

p1= SCpubr::do_ExpressionHeatmap(sample = subset(object, idents=levels(object)[8:12]),
                                  features = markers,
                                  viridis_direction = -1,group.by="annotation", slot="data",enforce_symmetry =F,viridis_color_map = "B",flip = TRUE,legend.position = "right",heatmap.legend.width = 3,heatmap.legend.length =30, min.cutoff =0,cluster_rows=F, max.cutoff = 3.5,cell_size = 5)

I then wanted to edit the parameters of p1 to change the font sizes of the genes and clusters names but I couldn't manage.

p1@ht_list$`Avg. Expression`@row_names_param$gp$fontsize= rep(8,length(markers))
doesn't change anything

Does anyone have an idea? Thanks

enblacar commented 1 year ago

Hi @kaizen89,

Apologies for the delay.

It appears that you are using an old version of SCpubr. SCpubr v2.0.0 onwards replaced the use of ComplexHeatmap with ggplot2 for heatmap-based plots, such as do_ExpressionHeatmap.

Would you perhaps consider updating to the latest version? This way, you can control the overarching font size of the plots with font.size parameter, applicable to every function in SCpubr as of v2.0.0.

Otherwise, in your specific case, I think you need to provide just 8 to p1@ht_list$Avg. Expression@row_names_param$gp$fontsize instead of rep(8,length(markers)).

Hope this helps! Please feel free to reopen the issue if you still need further feedback!

Best, Enrique