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

Allow for nanoplot output of horizontal bars #1514

Merged
merged 9 commits into from
Dec 23, 2023

Conversation

rich-iannone
Copy link
Member

@rich-iannone rich-iannone commented Dec 22, 2023

This allows for single line bar plots in cols_nanoplot(). If the plot_type is set to "bar" and single values are found, then horizontal bars will be generated. With single bars, the width is meaningless unless compared against other single values found across other rows. If there is a combination of single values and multiple values within the collection of rows, the single-value bar plots will only be proportional to the other single values (i.e., the different plot views won't interfere with each other).

Here is a simple example:

library(tidyverse)
library(gt)

dplyr::tibble(
  a = c(4.6, 0.2, 5.6, 6.3, 0, NA)
) %>%
  gt() %>%
  cols_nanoplot(columns = a, plot_type = "bar")
barplot-nanoplot

This also adds the autoscale arg so that plots can have a shared y and even x scale.

@rich-iannone rich-iannone marked this pull request as ready for review December 22, 2023 23:26
@rich-iannone rich-iannone merged commit c65b5af into master Dec 23, 2023
12 checks passed
@rich-iannone rich-iannone deleted the nanoplot-horizontal-bar branch December 23, 2023 01:21
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.

1 participant