2017-12-31 42 views
1

이상의 점을 모양과 채우기 및 색상을 일정하게 유지하면서 별도의 스타일을 사용하여 geom_point 음모를 꾸몄습니다. 여기 코드는 다음과 같습니다ggplot2 범례의 채우기 값이 잘못되었습니다.

ggmap(m) + 
geom_point(data = d, 
      aes(x = Longitude, y = Latitude, fill = Phylum, shape = Placecount), 
       colour = 'black', size = 2) + 
scale_shape_manual(values = c(21,22)) 

결과는 '문'이 잘못 전체에 검은 색과 관련된 전설을 제외하고 만족입니다.

enter image description here

+0

부터 = '흑색'컬러 제거 여기

는 mtcars와 일례이다 에이스() –

+0

@ 에드워드 먼데즈, 도움이 안됐어. – macleginn

답변

2

수동으로 모양 값이 + guides(fill = guide_legend(override.aes = list(shape = 21)))와 채우기 범례 (또는 전설)에 사용되는 조정할 수 있습니다. 기본값이 shape = 1 인 것처럼 보이므로 채우기를 지원하지 않으므로 단색 검정 모양을 얻고있는 것입니다.

ggplot(mtcars) + 
    geom_point(aes(hp, mpg, fill = as.factor(cyl), shape = as.factor(am))) + 
    scale_shape_manual(values = c(21,22)) + 
    guides(fill = guide_legend(override.aes = list(shape = 21))) 

플롯 override_aes()와 :

enter image description here

플롯없이 :

enter image description here

관련 문제