0

我有印度所有人口的数据。我使用了以下代码

 `G3 <- gvisGeoChart(Population, "States", "Population",
  options=list(region="IN", displayMode="regions", 
  resolution="provinces",
  width=600, height=400))
  plot(G3)`

地图正确显示,但未显示查蒂斯加尔州的数据(数据在我上传的文本文件中)。我在网上看到过类似的图表,但显示的也不一样。

http://visual.yantrajaal.com/2015/05/googlevis-best-of-r-and-googlecharts.html

4

1 回答 1

0

如果你ChattisgarhChhattisgarh(with Chh...) 替换它就可以工作。比较两个图:

library(googleVis)
StateMilk <- read.table(
  text = "State 'Cow Milk CD'   'Cow Milk ND'   'Cow Milk Total'    'Buffalo Milk'  'Goat Milk' Total
'Andhra Pradesh'    1268.0  1054.0  2322.0  6603.0  0.4 8925.0
'Arunachal Pradesh' 9.0 23.0    32.0    NA  NA  32.0
Assam   166.0   462.0   628.0   100.0   25.0    752.0
Bihar   986.0   1958.0  2943.0  2623.0  216.0   5783.0
Chattisgarh 56.0    471.0   527.0   296.0   43.0    866.0",
  header = TRUE, stringsAsFactors = FALSE)
plot(gvisGeoChart(StateMilk, "State", "Total", 
                  options=list(region="IN", displayMode="regions", resolution="provinces", width=600, height=400)))

查蒂斯加尔邦不会显示

StateMilk_with_2_h <- StateMilk
StateMilk_with_2_h$State[StateMilk_with_2_h$State == "Chattisgarh"] <- "Chhattisgarh"
plot(gvisGeoChart(StateMilk_with_2_h, "State", "Total", 
                  options=list(region="IN", displayMode="regions", resolution="provinces", width=600, height=400)))

恰蒂斯加尔邦展示

于 2017-01-12T15:44:28.037 回答