Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to color points by variable not in the dataset #198

Open
matthlfu opened this issue Mar 21, 2024 · 0 comments
Open

How to color points by variable not in the dataset #198

matthlfu opened this issue Mar 21, 2024 · 0 comments
Labels
help-request User requested help with the package

Comments

@matthlfu
Copy link

Hi there,

I'm trying to color the points of the plot by an additional dataset. Just as a short explanation: there are different grouping variables (PFOA, PFBA....), which do have different or the same number of c-atoms (see the color in the stripes). Is there a way to color the points according to the number of c-atoms (described in additional data frame) and to show the legend (ideally at the bottom of the whole plot)?

image

Sorry, the code is not reproducible. It's shown just to see how it works at the moment:

`
catome_metadata <- data.frame(
set=c("PFBA", "PFBS", "PFPeA", "PFPeS","PFHxA", "PFHxS", "PFHpA" , "PFHpS", "PFOA", "PFOS", "PFNA", "PFNS", "PFDA", "PFDS", "PFUnDA", "PFUnDS", "PFDoDA", "PFDoDS", "PFTrDA", "PFTrDS"),
catome=c('4', '4', '5', '5', '6', '6','7','7', '8', '8','9','9','10','10','11','11','12','12','13','13')
)

upset20222023 <- upset(
vennpfas20222023count,
colnames(vennpfas20222023count),
width_ratio=0.2,
base_annotations=list('Either here'=intersection_size() + ylab('Anzahl gemeinsamer \nNachweise')),
stripes=upset_stripes(
mapping=aes(color=catome),
geom = geom_segment(size = 7, show.legend=FALSE),
colors=colorlegend,
data=catome_metadata
),
set_sizes=(
upset_set_size(geom=geom_bar(width=0.4))
+ theme(
axis.line.x=element_line(colour='black'),
axis.ticks.x=element_line(),
)
+ ylab('Anzahl Nachweise')
),
ylab('Gemeinsame PFAS-Nachweise')
)`

@matthlfu matthlfu added the help-request User requested help with the package label Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-request User requested help with the package
Projects
None yet
Development

No branches or pull requests

1 participant