data("airquality")
head(airquality)
library(dplyr)
airquality%>%
filter(Month=="7" | Month == "8" | Month == "9") -> aq_trim
aq_trim$Month <- factor(aq_trim$Month,
labels = c("July", "August", "September"))
#fill <- c("#56B4E9", "#F0E442", "violetred1")
fill = c("steelblue", "yellowgreen", "violetred1")
p6 <- ggplot(aq_trim, aes(x = Day, y = Ozone, size = Wind, fill = Month)) +
geom_point(shape = 21) +
ggtitle("Air Quality in New York by Day") +
labs(x = "Day of the month", y = "Ozone (ppb)",
size = "Wind Speed (mph)", fill = "Months") +
scale_x_continuous(breaks = seq(1, 31, 5),
limits = c(0,31)) +
scale_fill_manual(values = fill) +
scale_size(range = c(1, 20)) +
theme(legend.position="bottom",
legend.direction="horizontal",
legend.box = "vertical",
legend.key.size = unit(1, "cm"),
axis.line = element_line(size=1, colour = "black"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_blank(),
axis.text.x=element_text(colour="black", size = 10),
axis.text.y=element_text(colour="black", size = 10),
legend.key = element_blank())+
#xlim(0,31)+
ylim(0,200)
p6
image.png
网友评论