Skip to content

Bivariate legend label options don't alter anything #1203

@ryanzomorrodi

Description

@ryanzomorrodi

Hi, it seems that many of the xlab and ylab options for bivariate legends don't work. For example, while I can change the legend title font family, the same cannot be said for the x of y labels. Likewise, align and font face also don't seem to work.

Reprex:

library(tmap)

tm_shape(land) +
  tm_raster(
    col = tm_vars(c("trees", "elevation"), multivariate = TRUE),
    col.scale = tm_scale_bivariate(
      values = "pu_gn_bivs",
      scale1 = tm_scale_intervals(breaks = c(0, 33, 66, 100)),
      scale2 = tm_scale_intervals(
        breaks = c(-500, 1500, 4000, 6500),
        labels = c("L", "M", "H")
      )
    ),
    col.legend = tm_legend_bivariate(
      title = "Title",
      xlab = "Scale 1",
      ylab = "Scale 2",
      title.align = "center",
      title.fontfamily = "monospace",
      title.fontface = 3,
      xlab.align = "center",
      xlab.fontfamily = "monospace",
      ylab.fontfamily = "monospace",
      xlab.fontface = 3,
      ylab.fontface = 3,
      item.height = 3,
      item.width = 3
    )
  )
#> [scale] tm_raster:() the data variable assigned to 'col' contains positive and negative values, so midpoint is set to 0. Set 'midpoint = NA' in 'fill.scale = tm_scale_intervals(<HERE>)' to use all visual values (e.g. colors)
#> [plot mode] fit legend/component: Some legend items or map compoments do not
#> fit well, and are therefore rescaled.
#> ℹ Set the tmap option `component.autoscale = FALSE` to disable rescaling.
#> Labels abbreviated by the first letters, e.g.: "L" => "L"
Image

Session info:

─ Session info ────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.5.1 (2025-06-13)
 os       Arch Linux
 system   x86_64, linux-gnu
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       America/Chicago
 date     2025-10-07
 pandoc   NA
 quarto   1.7.32 @ /usr/share/positron/resources/app/quarto/bin/quarto

─ Packages ────────────────────────────────────────────────────────────────
 package        * version    date (UTC) lib source
 abind            1.4-8      2024-09-12 [1] CRAN (R 4.5.1)
 base64enc        0.1-3      2015-07-28 [1] CRAN (R 4.5.1)
 class            7.3-23     2025-01-01 [2] CRAN (R 4.5.1)
 classInt         0.4-11     2025-01-08 [1] CRAN (R 4.5.1)
 cli              3.6.5      2025-04-23 [1] CRAN (R 4.5.1)
 codetools        0.2-20     2024-03-31 [2] CRAN (R 4.5.1)
 colorspace       2.1-1      2024-07-26 [1] CRAN (R 4.5.1)
 cols4all         0.9        2025-08-28 [1] CRAN (R 4.5.1)
 crosstalk        1.2.2      2025-08-26 [1] CRAN (R 4.5.1)
 data.table       1.17.8     2025-07-10 [1] CRAN (R 4.5.1)
 DBI              1.2.3      2024-06-02 [1] CRAN (R 4.5.1)
 digest           0.6.37     2024-08-19 [1] CRAN (R 4.5.1)
 e1071            1.7-16     2024-09-16 [1] CRAN (R 4.5.1)
 fastmap          1.2.0      2024-05-15 [1] CRAN (R 4.5.1)
 glue             1.8.0      2024-09-30 [1] CRAN (R 4.5.1)
 htmltools        0.5.8.1    2024-04-04 [1] CRAN (R 4.5.1)
 htmlwidgets      1.6.4      2023-12-06 [1] CRAN (R 4.5.1)
 KernSmooth       2.23-26    2025-01-01 [2] CRAN (R 4.5.1)
 lattice          0.22-7     2025-04-02 [2] CRAN (R 4.5.1)
 leafem           0.2.5      2025-08-28 [1] CRAN (R 4.5.1)
 leaflegend       1.2.1      2024-05-09 [1] CRAN (R 4.5.1)
 leaflet          2.2.3      2025-09-04 [1] CRAN (R 4.5.1)
 leafsync         0.1.0      2019-03-05 [1] CRAN (R 4.5.1)
 lifecycle        1.0.4      2023-11-07 [1] CRAN (R 4.5.1)
 logger           0.4.1      2025-09-11 [1] CRAN (R 4.5.1)
 lwgeom           0.2-14     2024-02-21 [1] CRAN (R 4.5.1)
 magrittr         2.0.4      2025-09-12 [1] CRAN (R 4.5.1)
 maptiles         0.10.0     2025-05-07 [1] CRAN (R 4.5.1)
 microbenchmark   1.5.0      2024-09-04 [1] CRAN (R 4.5.1)
 png              0.1-8      2022-11-29 [1] CRAN (R 4.5.1)
 proxy            0.4-27     2022-06-09 [1] CRAN (R 4.5.1)
 R6               2.6.1      2025-02-15 [1] CRAN (R 4.5.1)
 ragg             1.5.0      2025-09-02 [1] CRAN (R 4.5.1)
 raster           3.6-32     2025-03-28 [1] CRAN (R 4.5.1)
 Rcpp             1.1.0      2025-07-02 [1] CRAN (R 4.5.1)
 rlang            1.1.6      2025-04-11 [1] CRAN (R 4.5.1)
 s2               1.1.9      2025-05-23 [1] CRAN (R 4.5.1)
 sessioninfo      1.2.3      2025-02-05 [1] CRAN (R 4.5.1)
 sf               1.0-21     2025-05-15 [1] CRAN (R 4.5.1)
 sp               2.2-0      2025-02-01 [1] CRAN (R 4.5.1)
 spacesXYZ        1.6-0      2025-06-06 [1] CRAN (R 4.5.1)
 stars            0.6-8      2025-02-01 [1] CRAN (R 4.5.1)
 systemfonts      1.2.3      2025-04-30 [1] CRAN (R 4.5.1)
 terra            1.8-60     2025-07-21 [1] CRAN (R 4.5.1)
 textshaping      1.0.3      2025-09-02 [1] CRAN (R 4.5.1)
 tmap           * 4.2.0.9000 2025-10-07 [1] Github (r-tmap/tmap@f1f6476)
 tmaptools        3.3        2025-07-24 [1] CRAN (R 4.5.1)
 units            0.8-7      2025-03-11 [1] CRAN (R 4.5.1)
 wk               0.9.4      2024-10-11 [1] CRAN (R 4.5.1)
 XML              3.99-0.19  2025-08-22 [1] CRAN (R 4.5.1)

 [1] /home/user/R/x86_64-pc-linux-gnu-library/4.5
 [2] /usr/lib/R/library
 * ── Packages attached to the search path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions