ggplot2의 seals example을 기반으로 건물 전체 크기가 데이터 변수를보다 잘 반영하도록 화살표의 두께를 변경하려고합니다. 길이와 두께를 지정할 수는 있지만 화살촉의 크기를 변경하는 방법을 모릅니다. 모든 제안에 대해 매우 감사드립니다.ggplot의 크기가 비례적인 화살표
require(ggplot2)
require(grid)
d = seals[sample(1:nrow(seals), 100),]
d$size = sqrt(sqrt(d$delta_long^2 + d$delta_lat^2))
ggplot(d, aes(x = long, y = lat, size = size)) +
geom_segment(aes(xend = long + delta_long, yend = lat + delta_lat), arrow = arrow(length = unit(0.1,"cm")))
편집
솔루션 코드 :
ggplot(d, aes(x = long, y = lat, size = size)) +
geom_segment(aes(xend = long + delta_long, yend = lat + delta_lat),
arrow = arrow(length = unit(d$size/3, "cm"), type='closed')) +
scale_size(range = c(0, 2))
나는 당신에게 그것을주지! 솔루션에 대해서는 위의 추가 코드를 참조하십시오. – geotheory