Skip to content

Commit

Permalink
Add x_lab parameter to g_lineplot (#1126)
Browse files Browse the repository at this point in the history
Fixes #1125
  • Loading branch information
edelarua authored Nov 6, 2023
1 parent bc9364a commit 1d0c08c
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 261 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion R/g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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`?
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
)

Expand Down
3 changes: 3 additions & 0 deletions man/g_lineplot.Rd

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

Loading

0 comments on commit 1d0c08c

Please sign in to comment.