Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在Github页面上显示Plotly graph_R_Jekyll_Plotly_Github Pages - Fatal编程技术网

无法在Github页面上显示Plotly graph

无法在Github页面上显示Plotly graph,r,jekyll,plotly,github-pages,R,Jekyll,Plotly,Github Pages,我在R中有一个基于绘图的图形,我希望在我的github页面上显示它。转换为降价时,我无法显示图形。我能够呈现plotly plot的html,但我不知道如何使用页面 库(XML) 图书馆(GG2) 图书馆(tidyr) 图书馆(dplyr) 库(“地图”) 库('ggthemes') 库(“plotly”) 标记文件可以包含有效的html,因此您应该能够将绘图html文件内容复制/粘贴到标记文章中。或者,这可能会有所帮助。 library(XML) library(ggplot2) librar

我在R中有一个基于绘图的图形,我希望在我的github页面上显示它。转换为降价时,我无法显示图形。我能够呈现plotly plot的html,但我不知道如何使用页面

库(XML)
图书馆(GG2)
图书馆(tidyr)
图书馆(dplyr)
库(“地图”)
库('ggthemes')
库(“plotly”)

标记文件可以包含有效的html,因此您应该能够将绘图html文件内容复制/粘贴到标记文章中。或者,这可能会有所帮助。
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")