1

I'm having some trouble trying to plot a raster in tmap. It has 14 unique classes and all of them display fine with tmap_mode("plot"). However when I set tmap_mode("view") some classes do not display at all.

Left hand side of the area, which is Suburban(yellow) in the static map, does not display on the interactive map even though it's visible in the legend. Both maps were created using qtm - I tried changing the palette etc. but nothing worked.

I'm assuming I'm making a mistake and there is something obvious that I'm doing wrong.

> levels(lcm)
[[1]]
   ID                      Habitat
1   1           Broadleaf Woodland
2   2          Coniferous Woodland
3   3 Agriculture and Horticulture
4   4           Improved Grassland
5   5              Rough Grassland
6   6            Neutral Grassland
7  10                      Heather
8  11            Heather Grassland
9  14                  Inland Rock
10 16                   Freshwater
11 20            Littoral Sediment
12 21                    Saltmarsh
13 22                        Urban
14 23                     Suburban
tmap_mode("plot")
qtm(lcm)

enter image description here

tmap_mode("view")
qtm(lcm)

enter image description here

1 Answer 1

0

There are a number of reasons this could be occurring.

I would start by entering the command tmap_options(), locating $max.categories and confirming this number is set at 14 or greater. If you wish to change the max categories, enter tmap_options(max.categories = 14).

Something else I would try is avoiding qtm(lcm) and instead using

tm_shape(lcm)+tm_raster()

If all of your classes show up when you input tm_shape(lcm)+tm_raster() then I would suggest sticking with this longer structure for calling your interactive map(s) in the future. It may be a bit more time consuming, but you will have more control of the output and you may be able to diagnose future problems with more ease.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.