##tamp

library(tmap)

##Constant visual values

tm_shape(World)+ 
  tm_polygons(
    fill = "#006400", # fill color
    col = "black",    # line color
    lwd = 0.5,        # line width
    lty = "dashed")  
## [tip] Consider a suitable map projection, e.g. by adding `+ tm_crs("auto")`.
## This message is displayed once per session.

#Data-driven symbol

tm_shape(World)+ 
  tm_polygons(fill = "grey90") +   # constant fill color 
  tm_symbols(size = "pop_est",     # data variable, mapped to symbol size
             fill = "well_being",  # data variable, mapped to symbol fill color
             shape = "income_grp") # data variable, mapped to symbol shape

#Scales: numeric data (intervals)

tm_shape(World)+
tm_polygons(fill = "HPI")

#Scales: numeric data (intervals)

tm_shape(World)+ tm_polygons(
  fill = "HPI",
  fill.scale = tm_scale_intervals(
    style = "fisher",      # a method to specify the classes
    n = 7,                 # number of classes
    midpoint = 38,         # data value mapped to the middle palette color
    values = "pu_gn_div"   # color palette; 
                           # run cols4all::c4a_gui() to explore color palettes
  ))

ttmp()