geocompx / geocompr

Geocomputation with R: an open source book
https://r.geocompx.org/
Other
1.59k stars 584 forks source link

style argument for some tmap functions is deprecated #1069

Closed tibbles-and-tribbles closed 9 months ago

tibbles-and-tribbles commented 9 months ago

In subsection 9.2.4 "Scales" (https://r.geocompx.org/adv-map#scales), the style argument for tmap functions is discussed. There's a list of possible values for style, but there's no code example. When I run my own code example, I get a deprecation warning.

tm_shape(nz) +
  tm_polygons(
    fill = "Median_income",
    style = "pretty"
  )

Output:

tm_polygons: Deprecated tmap v3 code detected. Code translated to v4

But the style argument still works with functions like tm_scale_intervals(), so perhaps there's no issue here.

Nowosad commented 9 months ago

style is an argument in the tm_scale_intervals() function:

library(spData)
library(tmap)
tm_shape(nz) +
  tm_polygons(
    fill = "Median_income",
    tm_scale_intervals(style = "jenks")
  )

Nowosad commented 9 months ago

@tibbles-and-tribbles what do you think about this rewrite: https://github.com/geocompx/geocompr/pull/1070/files?

tibbles-and-tribbles commented 9 months ago

@Nowosad : yes that clarifies things!

Nowosad commented 9 months ago

Thanks! I also think it is better now.