Hello there,
I am going to do a data report, so I used ggplot to make a plot, but it seems there are some errors.
library(reprex)
delays <- read_csv("http://vis.cwick.co.nz/data/all-summary.csv")
delays$Origin <- factor(delays$Origin, levels = c("IAH", "HOU"))
ggplot(delays, aes(DepHour, DayOfWeek)) +
geom_tile(aes(fill = prop_over_15)) +
facet_wrap(~Origin,dir='v')+
scale_x_continuous("Departure time",
breaks = c(0, 6, 12, 18, 24),
labels = c("midnight", "6am", "noon", "6pm", "midnight"),
expand = c(0, 0),
limits = c(0, 23)) +
scale_y_discrete("Departure day") +
geom_rect(aes(
xmin = 18,
xmax = 22.5,
ymin = 'Mon',
ymax = 'Sun'
),
fill = NA,
color = "blue",
linetype = 3,
size = 1
)+
labs(title = "IAH has best evening ontime depatures over HOU",
subtitle = "Based on all departing flights from George Bush Intercontinental Airport (IAH) \nand Houston(HOU) in 2011") +
guides(color = "none") +
theme_classic() +
theme(axis.ticks.y = element_blank(), axis.line.y = element_blank(), axis.title.x = element_text(color = "black", size = 14, face = "bold"),
axis.title.y = element_text(color = "black", size = 14, face = "bold"),
axis.text.x = element_text(color = "black",face = "bold"),
axis.text.y = element_text(color = "black",face = "bold")
) + coord_equal()+
scale_fill_continuous_sequential(
name = "Flights delayed \nmore than 15 mins",
palette = "YlOrRd",
breaks = c(0, .25, 0.5, .75, 1),
labels = c("0%", "25%", "50%", "75%", "100%"),
expand = c(0, 0),
guide = "colorbar")
There is the message said:
Error in scale_fill_continuous_sequential(name = "Flights delayed \nmore than 15 mins", :
No "scale_fill_continuous_sequential" such a function.
And I remember some days ago here was a message said this function was masked and "The following objects are masked by ‘.GlobalEnv’", so I deleted all the R and related files from my computer and reinstall all of them.
But it still not working well, my R is 4.02, and R tools is 4.00.
Thank you guys!