I am trying to make an upset plot that only shows specific intersections. I have 6 different fjords which generate too many intersections. I am only interested in plotting some of those:
I have run this next script:
upset(fjords, fjordnames, width_ratio=0.15, height_ratio = 0.6, sort_sets=FALSE, sort_intersections = "descending", sort_intersections_by = 'cardinality',
base_annotations = list('Intersection size'=list(aes=aes(x=intersection, fill=Classification), geom=list(geom_bar(stat = "count", position='stack'),
theme(panel.border = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.line = element_line(colour = "black")), scale_fill_manual(values=divpalette)))))
I obtained the next plot: Species shared by fjords
But I am only interested in showing the intersections that are marked with the red arrow. I want all the others removed. I have looked for answers but have found none. Is there a way to only select those intersections?
Thank you in advanced
You need to first update to a recent version (minimum recommended 1.2):
And then use the
intersections
argument:You can keep the order by adding
sort_intersections=FALSE
.