我有一个闪亮的仪表板,可以在其中放置图形的标题,其中每个图形都属于特定的行。在这部分代码中,来自AIR的代码在ggplot部分而不是ggtitle部分被识别。知道解决方法的人吗?
output$plotFlights <- renderLeaflet({
df <- dataInputFlights()
leaflet() %>%
addTiles() %>%
addPolylines(data = df, lng = ~long, lat = ~lat, group = ~group, weight = 2, color = "#000000",
popup = popupGraph(ggplot(filter(leafletData, airline == df$airline, fromAirport == df$fromAirport, toAirport == df$toAirport, group == "A"),
aes(x = arr_delay)) + ggtitle(paste("van: ", fromAirport, " naar: ", toAirport)) +
geom_histogram(fill = "#000000") + geom_vline(aes(xintercept = mean(arr_delay, na.rm = TRUE)), color = "grey", linetype = "dashed", size = 1) +
xlab("Arrival delay") +
thema + guides(fill = FALSE)))
数据框看起来像这样
id group lat long airline distance fromAirport toAirport datum flightnumber arr_delay dep_delay
1 1 A 40.63975 -73.77893 Endeavor Air Inc. 1029 John F Kennedy Intl Minneapolis St Paul Intl 2013-01-01 3538 11 0
2 1 B 44.88196 -93.22177 Endeavor Air Inc. 1029 John F Kennedy Intl Minneapolis St Paul Intl 2013-01-01 3538 11 0
3 2 A 40.63975 -73.77893 Endeavor Air Inc. 228 John F Kennedy Intl Washington Dulles Intl 2013-01-01 4105 -2 -9
4 2 B 38.94453 -77.45581 Endeavor Air Inc. 228 John F Kennedy Intl Washington Dulles Intl 2013-01-01 4105 -2 -9
5 3 A 40.63975 -73.77893 Endeavor Air Inc. 301 John F Kennedy Intl Buffalo Niagara Intl 2013-01-01 3295 -2 -3
6 3 B 42.94053 -78.73217 Endeavor Air Inc. 301 John F Kennedy Intl Buffalo Niagara Intl 2013-01-01 3295 -2 -3
如果您需要更多信息来帮助我,请问我,我会给你的!