diff --git a/NEWS.md b/NEWS.md
index bd197f3432..4518169ae5 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -8,6 +8,7 @@
### Enhancements
* Added `ref_group_coxph` parameter to `g_km` to specify the reference group used for pairwise Cox-PH calculations when `annot_coxph = TRUE`.
* Added `annot_coxph_ref_lbls` parameter to `g_km` to enable printing the reference group in table labels when `annot_coxph = TRUE`.
+* Added `x_lab` parameter to `g_lineplot` to customize x-axis label.
### Miscellaneous
* Specified minimal version of package dependencies.
diff --git a/R/g_lineplot.R b/R/g_lineplot.R
index 7aed484867..f03c2f0e20 100644
--- a/R/g_lineplot.R
+++ b/R/g_lineplot.R
@@ -44,6 +44,7 @@
#' @param legend_position (`character`)\cr the position of the plot legend (`none`, `left`, `right`, `bottom`, `top`,
#' or two-element numeric vector).
#' @param ggtheme (`theme`)\cr a graphical theme as provided by `ggplot2` to control styling of the plot.
+#' @param x_lab (`character`)\cr x-axis label. If equal to `NULL`, then no label will be added.
#' @param y_lab (`character`)\cr y-axis label. If equal to `NULL`, then no label will be added.
#' @param y_lab_add_paramcd (`logical`)\cr should `paramcd`, i.e. `unique(df[[variables["paramcd"]]])` be added to the
#' y-axis label `y_lab`?
@@ -137,6 +138,7 @@ g_lineplot <- function(df,
legend_title = NULL,
legend_position = "bottom",
ggtheme = nestcolor::theme_nest(),
+ x_lab = obj_label(df[[variables[["x"]]]]),
y_lab = NULL,
y_lab_add_paramcd = TRUE,
y_lab_add_unit = TRUE,
@@ -330,7 +332,7 @@ g_lineplot <- function(df,
color = legend_title,
lty = legend_title,
shape = legend_title,
- x = attr(df[[x]], "label"),
+ x = x_lab,
y = y_lab
)
diff --git a/man/g_lineplot.Rd b/man/g_lineplot.Rd
index 6d1ad188cc..e2ec194c09 100644
--- a/man/g_lineplot.Rd
+++ b/man/g_lineplot.Rd
@@ -20,6 +20,7 @@ g_lineplot(
legend_title = NULL,
legend_position = "bottom",
ggtheme = nestcolor::theme_nest(),
+ x_lab = obj_label(df[[variables[["x"]]]]),
y_lab = NULL,
y_lab_add_paramcd = TRUE,
y_lab_add_unit = TRUE,
@@ -93,6 +94,8 @@ or two-element numeric vector).}
\item{ggtheme}{(\code{theme})\cr a graphical theme as provided by \code{ggplot2} to control styling of the plot.}
+\item{x_lab}{(\code{character})\cr x-axis label. If equal to \code{NULL}, then no label will be added.}
+
\item{y_lab}{(\code{character})\cr y-axis label. If equal to \code{NULL}, then no label will be added.}
\item{y_lab_add_paramcd}{(\code{logical})\cr should \code{paramcd}, i.e. \code{unique(df[[variables["paramcd"]]])} be added to the
diff --git a/tests/testthat/_snaps/g_km/grob-tmp-char.svg b/tests/testthat/_snaps/g_km/grob-tmp-char.svg
deleted file mode 100644
index cd5290d0dd..0000000000
--- a/tests/testthat/_snaps/g_km/grob-tmp-char.svg
+++ /dev/null
@@ -1,158 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/g_lineplot/g-lineplot-w-stats.svg b/tests/testthat/_snaps/g_lineplot/g-lineplot-w-stats.svg
index b3fd53ddc7..ea57b5d101 100644
--- a/tests/testthat/_snaps/g_lineplot/g-lineplot-w-stats.svg
+++ b/tests/testthat/_snaps/g_lineplot/g-lineplot-w-stats.svg
@@ -30,112 +30,113 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-18
-19
-20
-21
-22
-
-
-
-
-
-
-
-
-
-
-
-BASELINE
-WEEK 1 DAY 8
-WEEK 2 DAY 15
-WEEK 3 DAY 22
-WEEK 4 DAY 29
-WEEK 5 DAY 36
-Lab Test ALT (U/L)
+18
+19
+20
+21
+22
+
+
+
+
+
+
+
+
+
+
+
+BASELINE
+WEEK 1 DAY 8
+WEEK 2 DAY 15
+WEEK 3 DAY 22
+WEEK 4 DAY 29
+WEEK 5 DAY 36
+Time
+Lab Test ALT (U/L)
Description of Planned Arm
diff --git a/tests/testthat/test-g_lineplot.R b/tests/testthat/test-g_lineplot.R
index 9003191230..941dd8027a 100644
--- a/tests/testthat/test-g_lineplot.R
+++ b/tests/testthat/test-g_lineplot.R
@@ -18,6 +18,7 @@ testthat::test_that("g_lineplot works with custom settings and statistics table"
table = c("n", "mean", "mean_ci"),
control = control_analyze_vars(conf_level = 0.80),
title = "Plot of Mean and 80% Confidence Limits by Visit",
+ x_lab = "Time",
y_lab = "Lab Test",
subtitle = "Laboratory Test:",
caption = "caption"