为什么它说 radius = unit(0.1, "snpc") 的未使用参数

问题描述 投票:0回答:1

我正在尝试创建一个带有圆角的图形,但是当我输入参数 radius =unit(0.1, "snpc") 或 radius = 0.1 时,两者都会返回 'unused argument (radius = unit(0.1, "snpc") ) 或 (半径 = 0.1)' 分别。如何创建圆角而不出现此错误?

library(tidyverse)
library(dplyr)
library(ggplot2)
library(ggthemes)
library(grid)

read.csv("/Users/benjamincohn/Desktop/R studio/vaccination_percentages.csv") -> un

un %>%
  arrange(Uninsured) %>%
  ggplot(aes(y = Life.Expectancy.at.Birth..years., x = Uninsured, color = Location)) +
  geom_point() +
  scale_x_continuous(breaks = seq(2, 18, by = 1)) +
  scale_y_continuous(breaks = seq(70, 81, by = 1)) +
  geom_smooth(method = "lm", color = 'black') +
  ggtitle("Uninsured (%) vs. Life Expectancy at Birth (years) by State (2023)") +
  labs(y = "Life Expectancy at Birth (years)", x = "Uninsured (%)") +
  theme(axis.line = element_line(colour = "black", size = 1, linetype = "solid"),
        plot.background = element_rect(fill = "lightblue"),
        legend.key = element_rect(fill = "deepskyblue3"),
        legend.background = element_rect(fill = "deepskyblue3", radius = unit(0.1, "snpc")))
r ggplot2 r-grid
1个回答
0
投票
ggplot(mtcars, aes(wt, mpg, color = gear)) +
  geom_point() +
  theme(legend.background = ggfun::element_roundrect(fill = "gray80"))

© www.soinside.com 2019 - 2024. All rights reserved.