Skip to content

Commit

Permalink
Fix #14
Browse files Browse the repository at this point in the history
  • Loading branch information
csgillespie committed Feb 9, 2021
1 parent 29ff19e commit 105e563
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 5 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Improved `plot()` logic for the log scale
* Conditionally use {vdiffr} for testing (CRAN request)
* Bug: plot matrices fixes #13 (thanks to @gmonaie)
* BUg: barplot and axisnames. Fixes #14 (thanks to @yikeshu0611)

## Version 0.2.1
* Bug fix: Don't open plotting window when loading the package
Expand Down
6 changes: 2 additions & 4 deletions R/barplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ barplot.prettyB = function(height, width = 1, space = NULL, names.arg = NULL,
cex.names = par("cex.axis"), inside = TRUE,
plot = TRUE, axis.lty = 0, offset = 0,
add = FALSE, args.legend = NULL, ...) {
# op = set_par_minimal()
# on.exit(par(op))
setup_prettyB()

# Unchanged Arguments
Expand Down Expand Up @@ -124,10 +122,10 @@ barplot.prettyB = function(height, width = 1, space = NULL, names.arg = NULL,

if (isTRUE(args$horiz)) {
add_x_axis(ticks_x, tick = FALSE)
add_y_axis(lab_loc, labels = lab, tick = FALSE)
if (isTRUE(axisnames)) add_y_axis(lab_loc, labels = lab, tick = FALSE)
} else {
add_y_axis(ticks_y, tick = FALSE)
add_x_axis(lab_loc, labels = lab, tick = FALSE)
if (isTRUE(axisnames)) add_x_axis(lab_loc, labels = lab, tick = FALSE)
}
add_title(main)
add_sub(sub)
Expand Down
2 changes: 1 addition & 1 deletion R/par.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @title Set up par and palette
#' Set up par and palette
#'
#' Sets up par and palette
#' @export
Expand Down
57 changes: 57 additions & 0 deletions tests/figs/barplot/barplot-basic-no-axisnames.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions tests/testthat/test_barplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ test_that("Testing barplot", {
barplot_p(VADeaths, xlab = "X", ylab = "Y",
main = "Main", sub = "Sub"))

expect_doppelganger("barplot basic no axisnames",
barplot_p(VADeaths, axisnames = FALSE))
})

0 comments on commit 105e563

Please sign in to comment.