无法在Github页面上显示Plotly graph
我在R中有一个基于绘图的图形,我希望在我的github页面上显示它。转换为降价时,我无法显示图形。我能够呈现plotly plot的html,但我不知道如何使用页面无法在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
库(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")