没有使用geom_raster
的渐变色可以通过多种方式实现。以下是一些实现方式:
ggplot(data = df, aes(x = loc, y = cars_sold)) +
geom_col(fill = "darkblue") +
coord_flip() +
labs(title = "Number of Cars Sold by Dealership") +
facet_wrap(~V1) +
theme_bw() +
theme(panel.border = element_blank(), panel.grid = element_blank(), strip.text = element_blank()) +
scale_fill_manual(values = c("#66CC66", "#FDB813")) +
theme(legend.position = "none") +
labs(title = paste0("Number of Cars Sold by Dealership: ", year))
library(plotly)
plot_ly(data = df, x = loc, y = cars_sold, type = "bar", color = I("darkblue")) %>%
layout(title = "Number of Cars Sold by Dealership") %>%
facet_wrap(~V1) %>%
theme_bw() %>%
theme(panel.border = element_blank(), panel.grid = element_blank(), strip.text = element_blank()) %>%
scale_fill_manual(values = c("#66CC66", "#FDB813")) %>%
theme(legend.position = "none") %>%
labs(title = paste0("Number of Cars Sold by Dealership: ", year))
library(ggplot2)
ggplot(data = df, aes(x = loc, y = cars_sold)) +
geom_col(fill = "darkblue") +
coord_flip() +
labs(title = "Number of Cars Sold by Dealership") +
facet_wrap(~V1) +
theme_bw() +
theme(panel.border = element_blank(), panel.grid = element_blank(), strip.text = element_blank()) +
scale_fill_manual(values = c("#66CC66", "#FDB813")) +
theme(legend.position = "none") +
labs(title = paste0("Number of Cars Sold by Dealership: ", year)) +
theme(panel.margin = unit(0, "cm"))
以上是一些实现没有使用geom_raster
的渐变色的方法。你可以根据自己的需求选择其中一种进行使用。
领取专属 10元无门槛券
手把手带您无忧上云