Comments (3)
scale_colour_manual()
appears to be in an incorrect position, it should not be added to aes()
but after upset_set_size()
as is scale_y_continuous()
in your example.
from complex-upset.
Thank you for the quick response. Really appreciate that.
Unfortunately the set sizes plot seems to have reverted to the default colours (the same as in your example here: https://krassowski.github.io/complex-upset/articles/Examples_R.html#change-position-and-add-fill.)
Code below. Any ideas?
upset(
mm1, disease_names, width_ratio=0.2, height_ratio = 0.7,
base_annotations=list(
#Intersection size and annotations)
'Intersection size'=intersection_size(mode = 'exclusive_intersection',
text_mapping=aes(
label=paste0(!!size, '\n(', round(!!get_size_mode('exclusive_intersection')/nrow * 100), '%', ')'
)
), text=list(
size = 2.5), size=0.8,
mapping=aes(fill='bars_color')
) + ylab("Prevalence")
+ scale_y_continuous(labels=function(x) paste0(x/nrow*100, "%"), breaks = seq(0,0.30*nrow,0.10*nrow), limits = c(0,0.30*nrow))
+ scale_fill_manual(values=c('bars_color'= NA), guide='none')
+ theme(plot.background = element_rect(color = 'white', fill = 'white'),
element_line(linewidth = 0, colour = 'white'))
),
#sets and set annotations
encode_sets=FALSE, # for annotate() to select the set by name disable encoding
set_sizes=(
upset_set_size(position='right',
# add colours to the set sizes
geom=geom_bar(
aes(fill=mm_count2, x = group)))
+ scale_colour_manual(values = c(
"0"= 'steelblue1',
"1"= 'firebrick1',
"2" = 'violetred3',
"3" = 'royalblue2',
"4" = 'firebrick',
"5"= 'darkmagenta'))
+ geom_text(aes(label=paste0(..count.., ' (', round(..count../nrow*100), '%', ')')),
stat='count', hjust =1.1, vjust = "middle", size = 2.5, nudge_y = 80)
+ scale_y_continuous(labels=function(x) paste0(x/nrow*100, "%"), breaks = seq(0,0.50*nrow,0.20*nrow), limits = c(0,0.50*nrow))
# you can also add annotations on top of bars:
+ expand_limits(y=400)
+ theme(axis.text.x=element_text(angle=45))
+ ylab('Prevalence of individual diseases')
),
sort_sets = 'FALSE',
sort_intersections_by=c('degree', 'cardinality'),
ggtitle('Full data set'),
sort_intersections = 'ascending',
guides='over',
# colour arrangements for intersection matrix
queries= c(
query_by_degree(
mm1, disease_names,
mode=mode,
matrix=intersection_matrix(
geom=geom_point(shape='circle filled', size=10)),
params_by_degree=list(
'0'=list(color = 'steelblue1', fill='steelblue1'),
'1'=list(color = 'firebrick1', fill='firebrick1'),
'2'=list(color = 'violetred3', fill='violetred3'),
'3'=list( color = 'royalblue2',fill='royalblue2'),
'4'=list(color = 'firebrick',fill='firebrick'),
'5'=list(color = 'darkmagenta', fill='darkmagenta')), shared=list(
only_components=c("intersections_matrix", "Intersection size", "Set size"),
color='turquoise'))
)
)
from complex-upset.
worked it out. error in scale_fill_manual, where previously it was scale_colour_manual.
Thanks for your help!
from complex-upset.
Related Issues (20)
- add intersection of the union of certain sets within the same intersection upset plot. HOT 2
- Set default color of dots in the matrix plot HOT 1
- Ordering by intersection sizes and degree HOT 1
- y axis units for the intersection size and stacking plots HOT 7
- Adjusting “Intersection size” to display the percentage of each group when the bars are filled
- Changing the y-axis scale for intersection_size from ComplexUpset package HOT 1
- Mapping categorical values to dots in intersection matrix HOT 1
- Deviation
- Possible built-time bug in `upset_themes`
- Coloring multiple *specific* insections HOT 2
- API seems broken after the latest updates in ggplot2 (>= 3.5.0) HOT 28
- Error "The `axis.text.theta` theme element is not defined in the element hierarchy." HOT 2
- How to color points by variable not in the dataset
- Setting order of intersections with a long list
- Define one or two groups to be compared to all other groups HOT 1
- Error in plot_them(plot)! HOT 3
- Error in 'vec_slice()'
- Specifying Selected Intersections Doesn't Show Empty Intersections HOT 1
- Color intersections matrix and bars by degree
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from complex-upset.