YuLab-SMU / scatterpie

:art: scatter pie plot
https://cran.r-project.org/package=scatterpie
60 stars 16 forks source link

Add border color to pie spots #45

Open JThomasWatson opened 9 months ago

JThomasWatson commented 9 months ago

Hi, I enjoy these plots quite a bit. Thank you for making the package! Is it possible to change the border color (what geom point calls "color," not "fill") based on another variable? There's a categorical variable that we'd like to include in these plots to show which spots belong to which class (border color), as well as the mixture of cells within (inner pie plot).

JThomasWatson commented 9 months ago

Update - I found a workaround. plotSpatialScatterpie() requires a 2-column numeric matrix. I made a copy of that matrix as a data frame, adding the categorical variable I wanted to show. Then, adding + geom_point(data = data2, mapping = aes(x = coord_x, y = coord_y, color = layer), size = 2, alpha = 0.25) created another plot directly on top of the scatterpie, with the new geom_points being slightly larger than the pie plots so it achieves the same effect. I'll leave this open, though, as having a color argument in plotSpatialScatterpie() would be nice.