Skip to content

Commit

Permalink
Merge branch 'master' into floating-table
Browse files Browse the repository at this point in the history
  • Loading branch information
rich-iannone authored Feb 27, 2024
2 parents ca24b2c + 0844a32 commit 693f1db
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 41 deletions.
17 changes: 9 additions & 8 deletions R/format_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -9451,14 +9451,15 @@ fmt_url <- function(
#' Using a small portion of [`metro`] dataset, let's create a **gt** table. We
#' will only include a few columns and rows from that table. The `lines` and
#' `connect_rer` columns have comma-separated listings of numbers/letters
#' (corresponding to lines served at each station). We have a directory SVG
#' graphics for all of these lines in the package (the path for the image
#' directory can be accessed via `system.file("metro_svg", package = "gt")`),
#' and the filenames roughly correspond to the data in those two columns. The
#' `fmt_image()` function can be used with these inputs since the `path` and
#' `file_pattern` arguments allow us to compose complete and valid file
#' locations. What you get from this are sequences of images in the table cells,
#' taken from the referenced graphics files on disk.
#' (corresponding to lines served at each station). We have a directory of SVG
#' graphics for all of these lines within the package (the path for the
#' directory containing the images can be accessed via
#' `system.file("metro_svg", package = "gt")`), and the filenames roughly
#' correspond to the data in those two columns. The `fmt_image()` function can
#' be used with these inputs since the `path` and `file_pattern` arguments allow
#' us to compose complete and valid file locations. What you get from all of
#' this are sequences of images in the table cells, taken from the referenced
#' graphics files on disk.
#'
#' ```r
#' metro |>
Expand Down
14 changes: 8 additions & 6 deletions R/modify_columns.R
Original file line number Diff line number Diff line change
Expand Up @@ -2234,13 +2234,15 @@ cols_add <- function(
#'
#' @param missing_vals *Treatment of missing values*
#'
#' `singl-kw:[gap|zero|remove]` // *default:* `"gap"`
#' `singl-kw:[gap|marker|zero|remove]` // *default:* `"gap"`
#'
#' If missing values are encountered within the input data, there are three
#' strategies available for their handling: (1) `"gap"` will display data gaps
#' at the sites of missing data, where data lines will have discontinuities;
#' (2) `"zero"` will replace `NA` values with zero values; and (3) `"remove"`
#' will remove any incoming `NA` values.
#' strategies available for their handling: (1) `"gap"` will show data gaps
#' at the sites of missing data, where data lines will have discontinuities
#' and bar plots will have missing bars; (2) `"marker"` will behave like
#' `"gap"` but show prominent visual marks at the missing data locations; (3)
#' `"zero"` will replace `NA` values with zero values; and (4) `"remove"` will
#' remove any incoming `NA` values.
#'
#' @param autoscale *Automatically set x- and y-axis scale limits based on data*
#'
Expand Down Expand Up @@ -2742,7 +2744,7 @@ cols_nanoplot <- function(
rows = everything(),
plot_type = c("line", "bar", "boxplot"),
plot_height = "2em",
missing_vals = c("gap", "zero", "remove"),
missing_vals = c("gap", "marker", "zero", "remove"),
autoscale = FALSE,
autohide = TRUE,
columns_x_vals = NULL,
Expand Down
8 changes: 4 additions & 4 deletions R/utils_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ generate_nanoplot <- function(
x_vals = NULL,
expand_x = NULL,
expand_y = NULL,
missing_vals = c("gap", "zero", "remove"),
missing_vals = c("gap", "marker", "zero", "remove"),
all_y_vals = NULL,
all_single_y_vals = NULL,
plot_type = c("line", "bar"),
Expand Down Expand Up @@ -895,7 +895,7 @@ generate_nanoplot <- function(

if (is.na(data_y_points[i])) {

if (missing_vals == "gap") {
if (missing_vals == "marker") {

# Create a symbol that should denote that a
# missing value is present
Expand All @@ -905,7 +905,7 @@ generate_nanoplot <- function(
"cx=\"", data_x_points[i], "\" ",
"cy=\"", safe_y_d + (data_y_height / 2), "\" ",
"r=\"", data_point_radius_i + (data_point_radius_i / 2), "\" ",
"stroke=\"red\" ",
"stroke=\"", "red", "\" ",
"stroke-width=\"", data_point_stroke_width_i, "\" ",
"fill=\"white\" ",
">",
Expand Down Expand Up @@ -956,7 +956,7 @@ generate_nanoplot <- function(

if (is.na(data_y_points[i])) {

if (missing_vals == "gap") {
if (missing_vals == "marker") {

# Create a symbol that should denote that a
# missing value is present
Expand Down
2 changes: 1 addition & 1 deletion R/utils_render_latex.R
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ create_body_component_l <- function(data) {
if (!is.na(indent)) {
row_splits_body[[x]][row_label_col] <<-
paste0(
"\\hspace*{", indent_length_pt * indent, "px} ",
"\\hspace*{", indent_length_pt * indent, "pt} ",
row_splits_body[[x]][row_label_col]
)
}
Expand Down
14 changes: 8 additions & 6 deletions man/cols_nanoplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions man/fmt_image.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 693f1db

Please sign in to comment.