Comments (2)
Hello Philipp, the intersection size bar plot is not implemented with coord_cartesian(). The ggplot function for the main bar graph can be found in at the bottom of the MainBar.R file (https://github.com/hms-dbmi/UpSetR/blob/master/R/MainBar.R)
from upsetr.
Hello Jake,
Not sure whether this is helpful, but below is a slight adaption of your Make_main_bar function that uses coord_cartesian() to change y-axis dimensions of the bar plot (code can probably be optimized, but it worked for me). This will not throw an error, even if the value for mainbar.y.max is smaller than the largest set. This was useful in my special use case.
Sorry for sending the code snippet as is, but wasn't sure how this is properly done.
##
# if ymax is set by the user, save in a different variable adding the 10% space
if(is.null(ymax) == F){
y_coord <- ymax + 0.1 * ymax
}
# ten_perc creates appropriate space above highest bar so number doesnt get cut off
ten_perc <- ((max(Main_bar_data$freq)) * 0.1)
# currently ymax needs to be calculated in any case, because scale_y_continuous() is used, change?
ymax <- max(Main_bar_data$freq) + ten_perc
# if ymax is not set by the user then y_coord should equal calculated ymax
if(is.null(ymax) == T){
y_coord <- ymax
}
Main_bar_plot <- (ggplot(data = Main_bar_data, aes_string(x = "x", y = "freq"))
+ geom_bar(stat = "identity", width = 0.6,
fill = Main_bar_data$color)
+ scale_x_continuous(limits = c(0,(nrow(Main_bar_data)+1 )), expand = c(0,0),
breaks = NULL)
+ scale_y_continuous(limits = c(0, ymax),
expand = c(c(0,0), c(0,0)))
+ xlab(NULL) + ylab(ylabel) +labs(title = NULL)
+ theme(panel.background = element_rect(fill = "white"),
plot.margin = unit(c(0.5,0.5,0.19,0.5), "lines"), panel.border = element_blank(),
axis.title.y = element_text(vjust = -0.8, size = 8.3), axis.text.y = element_text(vjust=0.3,
size=7 ))
+ coord_cartesian(ylim = c(0, y_coord))) # use coord_cartesian to zoom in on plot
if((show_num == "yes") || (show_num == "Yes")){
Main_bar_plot <- (Main_bar_plot + geom_text(aes_string(label = "freq"), size = 2.2, vjust = -1,
angle = number_angles, colour = Main_bar_data$color))
}
from upsetr.
Related Issues (20)
- Is there a possibility of excluding self comparisons from upset plot? HOT 1
- Error in Input file
- Angled Text not aligned with Vertical Bars
- Missing intersections when filtering 0 count groups HOT 1
- Incorrect value of set size HOT 1
- How to get the genes that are part of each intersection?
- reopen: mb.ratio throws off set size bar vertical alignment
- MultiNet Displays Incorrect Results HOT 1
- How do I make the bar graph show the up and down relationship
- How to input margin
- number of sets
- Text scale for metadata plots HOT 1
- How do I set complement size using fromExpression?
- error with UpSetR plot HOT 1
- possible bug? HOT 1
- Option to change the y-axis limit HOT 1
- Adjust legend
- Result conflictions for the same data
- UpSet plot queries?
- Adding sets showed inconsistent results HOT 1
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 upsetr.