Skip to content

Allow for nanoplot output of horizontal bars #1514

Merged
rich-iannone merged 9 commits intomasterfrom
nanoplot-horizontal-bar
Dec 23, 2023
Merged

Allow for nanoplot output of horizontal bars #1514
rich-iannone merged 9 commits intomasterfrom
nanoplot-horizontal-bar

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
@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