Skip to content

Changing label font size in emapplot and cnetplot #786

@AEstebanMar

Description

@AEstebanMar

Hello @GuangchuangYu, I have a question regarding figure customisation.

I cannot find how to change font size of labels for emapplots and cnetplots in their documentation. I knew how to change this in older versions by modifying the cex_label_category parameter, but it is now gone and I cannot find a new argument that does the same thing.

I was also a bit confused for a bit because of the old cex_label_category argument and the new size_category arguments, which do radically different things but their definitions in documentation are very similar. I now understand how they differ, but I believe they could benefit from some clarification in function documentation.

I am also unable to understand what the label_format argument does in emapplot function. I have built a minimal script based on your tutorials to try to understand it. My script is as follows:

library(clusterProfiler)
library(enrichplot)
data(gcSample)
xx <- compareCluster(gcSample, fun="enrichKEGG",
                     organism="hsa", pvalueCutoff=0.05)
xx <- pairwise_termsim(xx)

p1 <- emapplot(xx, label_format = 1)
p2 <- emapplot(xx, label_format = 600)
pdf("test_emapplot.pdf")
cowplot::plot_grid(p1, p2, ncol=2, labels=LETTERS[1:2])
dev.off()

This is what I get as a result:

Image

I thought it would affect the category labels in any way. Am I not using it correctly?

To sum up, my issue is that I think the documentation for emapplots and cnetplots could be clearer, and I also would like to know how to manipulate the label font size to produce quality figures. Thank you in advance.

SessionInfo:

R version 4.5.1 (2025-06-13)
Platform: x86_64-pc-linux-gnu
Running under: SUSE Linux Enterprise Server 15 SP4

Matrix products: default
BLAS/LAPACK: /usr/lib64/openblas-pthreads/libopenblas.so.0;  LAPACK version 3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: Europe/Madrid
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] enrichplot_1.28.4      clusterProfiler_4.16.0

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.1        dplyr_1.1.4             farver_2.1.2
 [4] blob_1.2.4              R.utils_2.13.0          Biostrings_2.76.0
 [7] fastmap_1.2.0           lazyeval_0.2.2          tweenr_2.0.3
[10] digest_0.6.37           lifecycle_1.0.4         KEGGREST_1.48.1
[13] tidytree_0.4.6          RSQLite_2.4.3           magrittr_2.0.3
[16] compiler_4.5.1          rlang_1.1.6             tools_4.5.1
[19] igraph_2.1.4            data.table_1.17.8       ggtangle_0.0.7
[22] labeling_0.4.3          bit_4.6.0               gson_0.1.0
[25] plyr_1.8.9              RColorBrewer_1.1-3      aplot_0.2.8
[28] BiocParallel_1.42.1     withr_3.0.2             purrr_1.1.0
[31] BiocGenerics_0.54.0     R.oo_1.27.1             polyclip_1.10-7
[34] grid_4.5.1              stats4_4.5.1            GOSemSim_2.34.0
[37] GO.db_3.21.0            ggplot2_3.5.2           MASS_7.3-65
[40] scales_1.4.0            cli_3.6.5               crayon_1.5.3
[43] treeio_1.32.0           generics_0.1.4          ggtree_3.16.3
[46] httr_1.4.7              reshape2_1.4.4          ggforce_0.5.0
[49] DBI_1.2.3               qvalue_2.40.0           ape_5.8-1
[52] cachem_1.1.0            DOSE_4.2.0              stringr_1.5.1
[55] splines_4.5.1           parallel_4.5.1          ggplotify_0.1.2
[58] AnnotationDbi_1.70.0    XVector_0.48.0          yulab.utils_0.2.1
[61] vctrs_0.6.5             Matrix_1.7-4            jsonlite_2.0.0
[64] gridGraphics_0.5-1      IRanges_2.42.0          patchwork_1.3.2
[67] S4Vectors_0.46.0        bit64_4.6.0-1           ggrepel_0.9.6
[70] tidyr_1.3.1             glue_1.8.0              codetools_0.2-20
[73] cowplot_1.2.0           stringi_1.8.7           gtable_0.3.6
[76] GenomeInfoDb_1.44.2     UCSC.utils_1.4.0        tibble_3.3.0
[79] pillar_1.11.0           rappdirs_0.3.3          fgsea_1.34.2
[82] GenomeInfoDbData_1.2.14 R6_2.6.1                lattice_0.22-7
[85] Biobase_2.68.0          R.methodsS3_1.8.2       png_0.1-8
[88] memoise_2.0.1           ggfun_0.2.0             Rcpp_1.1.0
[91] fastmatch_1.1-6         scatterpie_0.2.5        nlme_3.1-168
[94] fs_1.6.6                pkgconfig_2.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions