无法在Github页面上显示Plotly图形

时间:2017-08-22 04:50:18

标签: r jekyll plotly github-pages

我在R中有一个基于图形的图形,我希望在我的github页面上显示它。当我转换为降价时,我无法显示图表。我能够渲染一个html的情节剧情,但我不知道如何使用pages.Here是我的rep和下面的文件markdown

library(XML)
library(ggplot2)
library(tidyr)
library(dplyr)
library('maps')
library('ggthemes')
library('plotly')

A_loc<-tbl_df(readLines("https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat"))
New_A_loc<-as.data.frame(sapply(A_loc, function(x) gsub("\"", "", x)))
New_A_loc<-separate(data = New_A_loc, col = value, into = c("Airport_id", "Name","City","Country","IATA","ICAO","Lat","Long","Alt","Timezone","DST","TZ","Type","Source"), sep = ",")
New_A_loc$Lat <- as.numeric(New_A_loc$Lat)

New_A_loc$Long <- as.numeric(New_A_loc$Long)
New_A_loc$Alt<-as.numeric(New_A_loc$Alt)
New_A_loc$Name<-as.character(New_A_loc$Name)

g <- list(showframe = FALSE,
  coastlinecolor = toRGB("white"),
  showland = TRUE,
  landcolor = toRGB("gray80"),
  showcountries = TRUE,
  countrycolor = toRGB("white"),
  countrywidth = 0.2,
  projection = list(type = 'Mercator'))


  plot_geo(New_A_loc, 
     lat = ~Lat, 
     lon = ~Long,
     text = ~City,
     mode='markers',
     marker = list(color = toRGB("purple"),
                   opacity = 0.5,
                   line = list(color = toRGB("purple"),
                               width = 0.5))
    ) %>%
    layout(geo = g) %>% htmlwidgets::saveWidget("New_2.html")

0 个答案:

没有答案