首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

没有使用geom_raster的渐变色

没有使用geom_raster的渐变色可以通过多种方式实现。以下是一些实现方式:

  1. ggplot2
代码语言: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))
  1. plotly
代码语言:R
复制
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))
  1. ggMarginal
代码语言:R
复制
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的渐变色的方法。你可以根据自己的需求选择其中一种进行使用。

页面内容是否对你有帮助?
有帮助
没帮助

相关·内容

领券