Could I splicing multiple colors into a single point?

Hi~
When creating a scatter plot to visualize my data, I aimed to distinguish points of different categories using colors (col Endo to Immune). However, I noticed that some points belong to multiple categories. To represent this overlap, I’d like to assign a unique color to each category and combine multiple colors for one points associated with more than one category. For instance, for the fourth point (SNP rs56222534), which belongs to the categories PT, LOH, and DCT, I want to highlight all three categories within the same point. How can I effectively display this overlapping information?

ggplot() + geom_point(data = plotdat, aes(x = snpnumber, y = PIP), shape = 16)

SNP	chr	POS	cs	snpnumber	PIP	ancestry	Allele1	Allele2	Endo	Podo	PT	LOH	DCT	PC	IC	Immune	cat_number
rs6703976	1	21836934	1	8	0.0443511152120338	EUR_EAS	T	C	1	0	0	0	0	0	0	0	1
rs16825455	1	21837755	1	8	0.0401403077815774	EUR_EAS	A	G	0	0	1	0	0	0	0	0	1
rs1256328	1	21896767	2	2	0.465631132492596	EUR_EAS	T	C	0	0	1	0	0	0	0	0	1
rs56222534	1	21863905	3	2	0.486814498509838	EUR	T	C	0	0	1	1	1	0	0	0	3
rs11586977	1	21864063	3	2	0.501966923909164	EUR	A	C	0	0	1	1	1	1	0	0	4

Thanks,
xicao

I think you can do this with the {scatterpie} package and {ggplot2} but I have never used it. See this vignette scatterpie: scatter pie plot

library(tidyverse)

plotdat <- tribble(
~SNP,	~chr,	~POS,	~cs,	~snpnumber,	~PIP,	~ancestry,	~Allele1,	~Allele2,	~Endo,	~Podo,	~PT,	~LOH,	~DCT,	~PC,	~IC,	~Immune,	~cat_number,
"rs6703976",	1,	21836934,	1,	8,	0.0443511152120338,	"EUR_EAS",	"T",	"C",	1,	0,	0,	0,	0,	0,	0,	0,	1,
"rs16825455",	1,	21837755,	1,	8,	0.0401403077815774,	"EUR_EAS",	"A",	"G",	0,	0,	1,	0,	0,	0,	0,	0,	1,
"rs1256328",	1,	21896767,	2,	2,	0.465631132492596,	"EUR_EAS",	"T",	"C",	0,	0,	1,	0,	0,	0,	0,	0,	1,
"rs56222534",	1,	21863905,	3,	2,	0.486814498509838,	"EUR",	"T",	"C",	    0,	0,	1,	1,	1,	0,	0,	0,	3,
"rs1158697",	1,	21864063,	3,	2,	0.501966923909164,	"EUR",	"A",	"C",	    0,	0,	1,	1,	1,	1,  0,	0,	4
)

plotdat %>%
  pivot_longer(cols = c(Endo,	Podo,	PT,	LOH,	DCT,	PC,	IC,	Immune,), names_to = "name", values_to = "value") %>%
  summarise(.by = -name, category = paste(name, collapse = " ")) %>% 
  ggplot() + 
  geom_point(# data = plotdat, 
    aes(
      x = snpnumber, 
      y = PIP,
      color = category), 
    shape = 16)