enrichplot icon indicating copy to clipboard operation
enrichplot copied to clipboard

Barplot widths not going lower than default when setting geom_col width

Open Dane-Z opened this issue 3 years ago • 0 comments

Hi, I'm trying to make the width of the bars of my barplot adjust based on the size of my image and on the length of the list of terms on the y axis so that the barplots we get dont feature fat bars, but I'm running into a problem.

I am able to adjust the width of the bars using the following code, but ONLY when specifying a number ABOVE the default (which I think is 0.9 to match the 90% of resolution?). Any value greater than 0.9 will adjust the bar sizes, but values below 0.9 do not change the bar widths at all suggesting that they are being overridden at some point? I can't seem to figure this out and can't seem to find any solutions online that actually address this problem, please help. I am using version 1.14.2. Right now I am only setting hardcoded values for width such as 1, 0.5, or 0.01 to test and troubleshoot so the issue is not in how I'm passing values to the width parameter.

print(graphics::barplot(kegg_result, showCategory=default_pathway_results,title = paste("KEGG","",sep=""), font.size=8) + scale_y_discrete(labels=function(x) stringr::str_trunc(x, 60)) + geom_col(width=1))
        dev.off()

Thank you!

Dane-Z avatar Oct 04 '22 18:10 Dane-Z