Home > OS >  Overlapping labels in heatmap plot
Overlapping labels in heatmap plot

Time:06-20

I am producing a heatmap via cooccur package but I am getting overlapping species names. How to solve it? The plot was produced by the following codes:

M <- cooccur(mat = M, type = "spp_site", thresh = T, spp_names = TRUE, prob = "hyper")
plot(M, plotrand = TRUE)

enter image description here

CodePudding user response:

Unfortunately, the author didn't use defined themes inside the function. In this post enter image description here

I would suggest playing around with the theme options from ggplot. Here is a good post which can help you for sure: Changing font size and direction of axes text in ggplot2

CodePudding user response:

Before you start fiddling with font sizes, you should check whether this is just an artificial problem caused by R incorrectly guessing the device size. I have noticed that this regularly occurs when a plot is saved to PDF with dev.copy and the following workaround always solved the problem for me:

  1. Resize the plotting window on screen.
  2. Redraw the plot by calling the plot command again.
  • Related