The code is exact the same, listed below:
library(plotly)
mh <- data.frame(
rank = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51),
state = c("CT", "MA", "VT", "SD", "MN", "NJ", "IA", "ND", "PA", "ME",
"DE", "NY", "AK", "MD", "IL", "HI", "MI", "DC",
"KY", "NH", "KS", "NM", "CA", "OK", "CO", "OH",
"NE", "FL", "WY", "WA", "MO", "TX", "NC", "GA",
"WI", "RI", "SC", "VA", "MT", "UT", "TN", "LA",
"WV", "MS", "IN", "AL", "AR", "ID", "OR", "AZ",
"NV")
)
plot_ly(
type = "choropleth",
locations = mh$state,
locationmode = "USA-states",
z = mh$rank
) %>%
layout(geo = list(scope = "usa"))

Here is the output, only scale bar displayed in the viewer window, no map.
Here is sessionInfo()
########################################################
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] bindrcpp_0.2.2 plotly_4.8.0 ggplot2_3.0.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.17 bindr_0.1.1 magrittr_1.5 tidyselect_0.2.4
[5] munsell_0.4.3 xtable_1.8-2 viridisLite_0.3.0 colorspace_1.3-2
[9] R6_2.2.2 rlang_0.2.1 httr_1.3.1 plyr_1.8.4
[13] dplyr_0.7.5 tools_3.5.0 grid_3.5.0 data.table_1.11.4
[17] gtable_0.2.0 withr_2.1.2 crosstalk_1.0.0 htmltools_0.3.6
[21] yaml_2.1.19 lazyeval_0.2.1 assertthat_0.2.0 digest_0.6.15
[25] tibble_1.4.2 shiny_1.1.0 later_0.7.3 tidyr_0.8.1
[29] purrr_0.2.5 promises_1.0.1 htmlwidgets_1.2 mime_0.5
[33] glue_1.2.0 compiler_3.5.0 pillar_1.2.3 scales_0.5.0
[37] jsonlite_1.5 httpuv_1.4.3 pkgconfig_2.0.1
> rstudioapi::versionInfo()
############################################################
$`citation`
To cite RStudio in publications use:
RStudio Team (2016). RStudio: Integrated Development for R. RStudio,
Inc., Boston, MA URL http://www.rstudio.com/.
A BibTeX entry for LaTeX users is
@Manual{,
title = {RStudio: Integrated Development Environment for R},
author = {{RStudio Team}},
organization = {RStudio, Inc.},
address = {Boston, MA},
year = {2016},
url = {http://www.rstudio.com/},
}
$`mode`
[1] "desktop"
$version
[1] ‘1.1.383’
Thank you!