相关疑难解决方法(0)

如何在使用geom_sf时删除边框线?

我尝试过以下操作:

ggplot(geography) + geom_sf(aes(fill=rate, color = NULL))
Run Code Online (Sandbox Code Playgroud)

但那并没有摆脱边界线.

r geospatial ggplot2

10
推荐指数
1
解决办法
3166
查看次数

如何为geom_point大小添加条件?

我正在尝试为geom_point大小添加一个条件,并在下面粘贴了示例。我希望当n_in_stat为4或更大时,geom_point的大小为2,而当n_in_stat小于4时,大小为5。我尝试将ifelse语句放入geom_point内,但这失败了。也许我不能在这里包括逻辑运算符,而我必须在data.frame中创建一个新列并将其大小设置为?

geom_point(size = ifelse(n_in_stat <4,5,2))+#尝试使用ifelse设置大小

geom_point(aes(size = n_in_stat))+#原始线性缩放

library(ggplot2)

# Create a long data.frame to store data...
growth_series = data.frame ("read_day" = c(0, 3, 9, 0, 3, 9, 0, 2, 8), 
"series_id" = c("p1s1", "p1s1", "p1s1", "p1s2", "p1s2", "p1s2", "p3s4", "p3s4", "p3s4"),
"mean_od" = c(0.6, 0.9, 1.3, 0.3, 0.6, 1.0, 0.2, 0.5, 1.2),
"sd_od" = c(0.1, 0.2, 0.2, 0.1, 0.1, 0.3, 0.04, 0.1, 0.3),
"n_in_stat" = c(8, 8, 8, 8, 7, 5, 8, 7, 2)
)

# Plot using ggplot... …
Run Code Online (Sandbox Code Playgroud)

size r scale ggplot2

6
推荐指数
1
解决办法
5424
查看次数

标签 统计

ggplot2 ×2

r ×2

geospatial ×1

scale ×1

size ×1