I have successfully installed the plotly library for R.
To get started, I completed their getting started guide for R and directly copied the code from several graphs in my RStudio version 0.99.489.
Examples for scatter plots, field plots, etc. work well.
Examples for bubble and choropleth maps do not display correctly. Maps are not displayed at all. After running the code, only the title and legend are displayed.
Code References:
https://plot.ly/r/bubble-maps/
https://plot.ly/r/choropleth-maps/
Can anyone help?
Thanks in advance.
EDIT:
Instruments:
Dense library 2.016 for R
R Studio Version 0.99.489
R Version 3.2.2
Work in Windows 7 Home 64
One set of code tried to use the Plotly Bubble Map (copied directly from its user guides / code samples:
library(plotly) df <- read.csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_us_cities.csv') df$hover <- paste(df$name, "Population", df$pop/1e6, " million") df$q <- with(df, cut(pop, quantile(pop))) levels(df$q) <- paste(c("1st", "2nd", "3rd", "4th", "5th"), "Quantile") df$q <- as.ordered(df$q) g <- list( scope = 'usa', projection = list(type = 'albers usa'), showland = TRUE, landcolor = toRGB("gray85"), subunitwidth = 1, countrywidth = 1, subunitcolor = toRGB("white"), countrycolor = toRGB("white") ) plot_ly(df, lon = lon, lat = lat, text = hover, marker = list(size = sqrt(pop/10000) + 1), color = q, type = 'scattergeo', locationmode = 'USA-states') %>% layout(title = '2014 US city populations<br>(Click legend to toggle)', geo = g)
CHANGE No. 2
I highlighted the problem here:
plot_ly(df, lon = lon, lat = lat, text = hover, marker = list(size = sqrt(pop/10000) + 1), color = q, type = 'scattergeo', locationmode = 'USA-states')
I am not sure how to fix the problem here or simplify the syntax to find out what might happen.