Skip to content

How to adjust distance between bar and x- or y-axis in create.barplot()? #92

Answered by stefaneng
WuSelina asked this question in Q&A
Discussion options

You must be logged in to vote

@WuSelina I think what you want is to set ylimits, or xlimits if vertical.

For example:

library(BoutrosLab.plotting.general)

barplot.data <- data.frame(
    samples = c(1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 5L, 5L, 6L, 6L, 7L, 7L),
    values = c(8, 2, 2, 1, 27, 2, 6, 2, 4, 3, 2, 0, 4, 2),
    mutation = c("nonsynonymous", "other", "nonsynonymous", 
    "other", "nonsynonymous", "other", "nonsynonymous", "other", 
    "nonsynonymous", "other", "nonsynonymous", "other", "nonsynonymous", 
    "other")
    )

create.barplot(
    formula = samples ~ values,
    data = barplot.data,
    groups = mutation,
    col = default.colours(2),
    plot.horizontal = TRUE,
    stack = TRUE,
    ylimits = c(0.6, 

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by WuSelina
Comment options

WuSelina
Feb 20, 2023
Maintainer Author

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dan-knight
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants