1
第コード:TMAPパッケージ:同じtm_fillに複数tm_text()色依存行う()値
library(tmap)
library(tmaptools)
data("Europe")
# subset just three countries for illustration
threeC <- Europe[Europe$sovereignt %in% c("Germany", "Poland", "Ukraine"), ]
tm_shape(threeC) +
tm_polygons() +
tm_shape(threeC) +
tm_borders() +
tm_fill("pop_est",
palette = get_brewer_pal("YlGnBu"),
legend.show = F,
style = "order") +
tm_text("sovereignt", size = .8) +
tm_shape(threeC) +
tm_text("pop_est", size = .8, auto.placement = .1)
質問1:それは "を示すことができますpop_est "は、tm_text()関数内の式を使用して82.32m、38.48m、45.70mのように2桁の小数点以下2桁の数百万でマップします(つまり、データフレームに別のカスタム列を作成せずに、" pop_est ")?
質問2:国名を示すテキストの色は黒または白です(ここでは「ドイツ」は白で、他の2つの国名は黒で印刷されています)。塗りつぶしの色によって、大きな地図での視認性に大きく役立ちます。しかし、 "pop_est"数字を示す追加テキストの色は常に黒です。視認性を高めるために塗りつぶしの色に応じて黒または白にする方法?