library
(maps
)
library
(ggplot2
)
qplot
(long
,lat
,data
=us.cities
,color
=('blue'))+borders
("state",size
=0.5)
library
(plotly
)
library
(xlsx)
library
(DT
)
df
<- read.xlsx2
("D:\\R\\america.xlsx",sheetIndex
= 1)
df
$hover
<- with
(df
, paste
(state
, '<br>', "确诊人数:", definte
,"<br>","死亡人数:", death
, "<br>","死亡率:",rate
,"%"))
fig
<- plot_geo
(df
, locationmode
= 'USA-states')
fig
<- fig
%>% add_trace
(
locations
= ~code
,
type
='choropleth',
z
= ~definte
,
text
= ~hover
,
colorscale
="Reds"
)
fig
<- fig
%>% layout
(title
= "美国疫情状况")
fig
转载请注明原文地址:https://blackberry.8miu.com/read-27022.html