Skip to content

Commit

Permalink
Merge pull request #693 from dsheldon/master
Browse files Browse the repository at this point in the history
Plotting tweaks: bug fix for x label, and support night shading with missing data
  • Loading branch information
adokter authored Jan 16, 2025
2 parents ec53dc1 + 20723fe commit 4c031c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

* Fixes a bug that prevented a data.frame to be converted to a vpts object with as.vpts() when profiles are not sorted in datetime and height (#692).

* Bugfix for ignored `xlab` argument in `plot.vpi()` and night shading fix for dealing with NA values (#693)

# bioRad 0.8.1

## bugfixes
Expand Down
8 changes: 4 additions & 4 deletions R/plot.vpi.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ plot.vpi <- function(x, quantity = "mtr", xlab = "time",

# plot the data
plot(x$datetime, x[quantity][[1]],
type = "l", xlab = "time", ylab = ylab,
type = "l", xlab = xlab, ylab = ylab,
ylim = ylim, main = main, xaxs = "i", yaxs = "i", ...
)

Expand Down Expand Up @@ -145,8 +145,8 @@ plot.vpi <- function(x, quantity = "mtr", xlab = "time",
# determine the plot range of the night time shading
if (missing(ylim)) {
pol.range <- c(
min(c(0, 2 * min(x[quantity][[1]]))),
2 * max(x[quantity][[1]])
min(c(0, 2 * min(x[quantity][[1]], na.rm = TRUE))),
2 * max(x[quantity][[1]], na.rm = TRUE)
)
} else {
pol.range <- ylim
Expand All @@ -167,7 +167,7 @@ plot.vpi <- function(x, quantity = "mtr", xlab = "time",
# plot the data again on top of the shading
graphics::points(x$datetime, x[quantity][[1]],
type = "l",
xlab = "time", ylab = ylab, ylim = ylim, main = main, ...
xlab = xlab, ylab = ylab, ylim = ylim, main = main, ...
)
}
}

0 comments on commit 4c031c7

Please sign in to comment.