Пробелы при использовании geom_scatterpie - PullRequest
0 голосов
/ 21 октября 2018

Добрый день,

Я использую geom_scatterpie (R) для построения пирогов в разных местах по всему миру.Для некоторых пирогов у меня есть пробелы, и я не знаю, как решить проблему

enter image description here

Я проверил сумму процентов для каждого сайта, и она равнана 1.

Кто-нибудь имел такую ​​же проблему и нашел решение, чтобы исправить ее?

Большое спасибо за вашу помощь, Приветствия, Сальма.

# World map
world <- map_data('world')
world
p2 <- ggplot(world, aes(long, lat)) +
    geom_map(map=world, aes(map_id=region), fill=NA, color="black") +
    coord_quickmap()

#Increase the size of the axis text and axis titles of the world map
p2 <-  p2 + labs(x = "Longitude") + labs(y = "Latitude") +
                      theme(axis.text.y = element_text(size = 18, color = "black")) + 
                      theme(axis.text.x = element_text(size = 18, color = "black")) + 
                      theme(axis.title = element_text( face="bold", size=28)) + 
                      labs(fill="") #add a title to the legend


p2 <-  p2 + geom_scatterpie(aes(x=POINT_X, y=POINT_Y, group=region, r=radius*350, sorted_by_radius = TRUE), data=classification, cols=c("No data", "Stable", "Accretion", "Erosion", "Extreme erosion", "Intense erosion", "Severe erosion"),  alpha=0.7) + coord_equal()+ geom_scatterpie_legend(classification$radius, x=-200, y=-50, n=3)

# legend title
p2 <- p2 + theme(legend.title = element_text(colour="black", size=18, 
                                      face="bold"))
# legend labels
p2 <- p2 + theme(legend.text = element_text(colour="black", size=18))

colors <- c( '#4575b4','#fee090', '#fdae61', '#f46d43','#DCDCDC', '#d73027', '#e0f3f8' )  

p2 <- p2 +  scale_fill_manual(name = "",  values = colors)
...