Skip to content

Commit

Permalink
Zooming in on figure with coord_cartesean() (#437)
Browse files Browse the repository at this point in the history
* Update visr.R

* add rprofile

* increment version number

* Update visr.R

* updated news

* adding snapshot testing

* Update test-visr_survfit.R
  • Loading branch information
ddsjoberg authored Jul 12, 2022
1 parent 35aecf4 commit 50ec226
Show file tree
Hide file tree
Showing 52 changed files with 6,898 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# this sets the dev folder in the .libPath
# if user has not set up dev mode, nothing will happen
tryCatch(
devtools::dev_mode(on = TRUE),
error = function(e) invisible()
)
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ vignettes/*.pdf
inst/doc
README.html
docs/
tests/testthat/_snaps/
.Rprofile
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: visR
Title: Clinical Graphs and Tables Adhering to Graphical Principles
Version: 0.3.0.9002
Version: 0.3.0.9003
Authors@R: c(
person("Mark", "Baillie", , "bailliem@gmail.com", role = c("aut", "cre", "cph")),
person("Diego", "Saldana", , "diego.saldana@roche.com", role = "aut"),
Expand Down
3 changes: 1 addition & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# visR (development version)

### Bug Fixes
* We now zoom in on a figure (e.g. Kaplan-Meier figure) with `ggplot2::coord_cartesian()` instead of using `scale_x_continuous(limits=)` and `scale_y_continuous(limits=)`. The latter first removes data outside the limits, then constructs the line. Zooming constructs the full line, then zooms into the limits. This is useful because the risktable often reports estimates near the end of a KM figure, but the line is cutoff and not shown at the last time point. (#402)

* README update to contributor listing. (#435)


# visR 0.3.0

### New functions
Expand Down
20 changes: 12 additions & 8 deletions R/visr.R
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,16 @@ visr.survfit <- function(x = NULL,
)) +
ggplot2::geom_step(ggplot2::aes(y = est, col = strata)) +
ggplot2::scale_x_continuous(
breaks = x_ticks,
limits = c(min(x_ticks), max(x_ticks))
breaks = x_ticks
) +
ggplot2::xlab(x_label) +
ggplot2::scale_y_continuous(
breaks = y_ticks,
labels = yscaleFUN,
limits = c(min(y_ticks), max(y_ticks))
labels = yscaleFUN
) +
ggplot2::coord_cartesian(
xlim = c(min(x_ticks), max(x_ticks)),
ylim = c(min(y_ticks), max(y_ticks))
) +
ggplot2::ylab(y_label) +
ggplot2::labs(color = .construct_strata_label(x)) +
Expand Down Expand Up @@ -533,14 +535,16 @@ visr.tidycuminc <- function(x = NULL,
)) +
ggplot2::geom_step(ggplot2::aes(y = est, col = strata)) +
ggplot2::scale_x_continuous(
breaks = x_ticks,
limits = c(min(x_ticks), max(x_ticks))
breaks = x_ticks
) +
ggplot2::xlab(x_label) +
ggplot2::scale_y_continuous(
breaks = y_ticks,
labels = yscaleFUN,
limits = c(min(y_ticks), max(y_ticks))
labels = yscaleFUN
) +
ggplot2::coord_cartesian(
xlim = c(min(x_ticks), max(x_ticks)),
ylim = c(min(y_ticks), max(y_ticks))
) +
ggplot2::ylab(y_label) +
ggplot2::labs(color = .construct_strata_label(x)) +
Expand Down
Binary file modified tests/testthat/Rplots.pdf
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-3-style-ribbon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-3-style-step.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 114 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-5.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-6.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 114 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-blank.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-dashed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-dotdash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-dotted.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-longdash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-4-linetype-twodash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-alpha-0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-alpha-05.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t1-alpha-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 111 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t2-1-one-strata.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
166 changes: 166 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t2-2-10strata.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
226 changes: 226 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t2-2-20strata.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 136 additions & 0 deletions tests/testthat/_snaps/add_CI/add-ci-t2-2-5strata.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
226 changes: 226 additions & 0 deletions tests/testthat/_snaps/add_CNSR/add-cnsr-t1-1-one-strata.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
263 changes: 263 additions & 0 deletions tests/testthat/_snaps/add_CNSR/add-cnsr-t1-2-trtp.svg

Large diffs are not rendered by default.

112 changes: 112 additions & 0 deletions tests/testthat/_snaps/add_CNSR/add-cnsr-t1-3-shape-empty-string.svg
Loading

0 comments on commit 50ec226

Please sign in to comment.