Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose additional text options for text above bars in create.barplot #102

Merged
merged 9 commits into from
May 23, 2023

Conversation

stefaneng
Copy link
Contributor

Description

Add additional text options for text above bars in create.barplot. Exposes all panel.text (ltext) options to customize alpha, col, cex, etc.

Closes #101

Checklist

  • This PR does NOT contain PHI or germline genetic data. A repo may need to be deleted if such data is uploaded. Disclosing PHI is a major problem.
  • This PR does NOT contain molecular files, compressed files, output files such as images (e.g. .png, .jpeg), .pdf, .RData, .xlsx, .doc, .ppt, or other non-plain-text files. To automatically exclude such files using a .gitignore file, see here for example.
  • I have read the code review guidelines and the code review best practice on GitHub check-list.
  • I have set up or verified the main branch protection rule following the github standards before opening this pull request.
  • The name of the branch is meaningful and well formatted following the standards, using [AD_username (or 5 letters of AD if AD is too long)]-[brief_description_of_branch].
  • I have added the major changes included in this pull request to the CHANGELOG.md under the next release version or unreleased, and updated the date.

Analysis Results

library(BoutrosLab.plotting.general);

set.seed(1313);
my.data <- data.frame(
    samples = 1:15,
    counts = sample(1:50, replace = TRUE, size = 15)
);

create.barplot(
    formula = counts ~ samples,
    data = my.data,
    text.above.bars = list(
        labels = c('a','b','c','*'),
        padding = 4,
        bar.locations = c(1, 3, 11, 14),
        rotation = 0,
        # All panel.text arguments are exposed
        cex = c(2, 2, 2, 1),
        alpha = 0.5,
        col = c('red', 'black', 'black', 'black')
        )
    );

# Horizontal
create.barplot(
    formula = samples ~ counts,
    data = my.data,
    plot.horizontal = TRUE,
    text.above.bars = list(
        labels = c('a','b','c','d'),
        padding = 1,
        bar.locations = c(1, 3, 11, 14),
        rotation = 0,
        # All panel.text arguments are exposed
        cex = 1.5
        )
    );

Created on 2023-03-01 with reprex v2.0.2

@stefaneng stefaneng requested a review from jarbet March 2, 2023 04:07
@stefaneng stefaneng requested review from dan-knight and a team as code owners March 2, 2023 04:07
Copy link
Contributor

@jarbet jarbet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

man/create.barplot.Rd Outdated Show resolved Hide resolved
jarbet
jarbet previously approved these changes Mar 6, 2023
@stefaneng stefaneng assigned stefaneng and dan-knight and unassigned stefaneng Apr 14, 2023
@dan-knight dan-knight merged commit 660f8fa into main May 23, 2023
@dan-knight dan-knight deleted the stefaneng-barplot-text-above-101 branch May 23, 2023 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

create.barplot: how to change fontsize of text.above.bars ?
3 participants