Skip to content

Commit 0f4df8c

Browse files
authored
Merge branch 'master' into facet-depracated
2 parents 260804e + b1ef699 commit 0f4df8c

File tree

6 files changed

+71
-4
lines changed

6 files changed

+71
-4
lines changed

.github/CONTRIBUTING.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Contributing to bayesplot
2+
3+
This outlines how to propose a change to bayesplot and is based on similar
4+
instructions for tidyverse packages, including the contributing guidelines
5+
generated by `usethis::use_tidy_contributing()`.
6+
7+
## Fixing typos
8+
9+
You can fix typos, spelling mistakes, or grammatical errors in the documentation
10+
directly using the GitHub web interface, as long as the changes are made in the
11+
_source_ file. This generally means you'll need to edit
12+
[roxygen2 comments](https://roxygen2.r-lib.org/articles/roxygen2.html) in an `.R`,
13+
not a `.Rd` file. You can find the `.R` file that generates the `.Rd` by reading
14+
the comment in the first line.
15+
16+
## Bigger changes
17+
18+
If you want to make a bigger change, it's a good idea to first file an issue and
19+
make sure someone from the team agrees that it’s needed. If you’ve found a bug,
20+
please file an issue that illustrates the bug with a minimal reproducible
21+
example (see e.g. the [tidyverse reprex instructions](https://www.tidyverse.org/help/#reprex)).
22+
The tidyverse guide on [how to create a great issue](https://code-review.tidyverse.org/issues/)
23+
has more advice.
24+
25+
### Pull request process
26+
27+
If you are new to creating pull requests here are some tips. Using the functions
28+
from the `usethis` package is not required but can be helpful if this process is
29+
new to you.
30+
31+
* Fork the package and clone onto your computer. If you haven't done this before, we recommend using `usethis::create_from_github("stan-dev/bayesplot", fork = TRUE)`.
32+
33+
* Install all development dependencies with `devtools::install_dev_deps()`, and then make sure the package passes R CMD check by running `devtools::check()`.
34+
If R CMD check doesn't pass cleanly, it's a good idea to ask for help before continuing.
35+
* Create a Git branch for your pull request (PR). We recommend using `usethis::pr_init("brief-description-of-change")`.
36+
37+
* Make your changes, commit to git, and then create a PR by running `usethis::pr_push()`, and following the prompts in your browser.
38+
The title of your PR should briefly describe the change.
39+
The body of your PR should contain `Fixes #issue-number`.
40+
41+
* For user-facing changes, add a bullet to the top of `NEWS.md` (i.e. just below the first header). Follow the style already used in `NEWS.md`.
42+
43+
### Code style
44+
45+
* New code should attempt to follow the style used in the package. When in doubt follow the tidyverse [style guide](https://style.tidyverse.org).
46+
47+
* We use [roxygen2](https://cran.r-project.org/package=roxygen2), with [Markdown syntax](https://cran.r-project.org/web/packages/roxygen2/vignettes/rd-formatting.html), for documentation.
48+
49+
* We use [testthat](https://cran.r-project.org/package=testthat) for unit tests.
50+
Contributions with test cases included are easier to accept.
51+
52+
## Code of Conduct
53+
54+
Please note that the bayesplot project follows the Stan project's
55+
[Code of Conduct](https://discourse.mc-stan.org/t/announcing-our-new-stan-code-of-conduct/23764).
56+
By contributing to this project you agree to abide by its terms.

R/bayesplot-ggplot-themes.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ theme_default <-
5454
panel.spacing = unit(1.5, "lines"),
5555
legend.position = "right",
5656
legend.background = element_blank(),
57-
legend.text = element_text(size = 13),
58-
legend.text.align = 0,
57+
legend.text = element_text(size = 13, hjust = 0),
5958
legend.key = element_blank()
6059
)
6160
}

R/bayesplot-helpers.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,11 @@ calc_intervals <- function(x, p, med = TRUE, ...) {
333333
#' equivalent to using `legend_none()`.
334334
#'
335335
legend_move <- function(position = "right") {
336-
theme(legend.position = position)
336+
if (is.numeric(position) && "legend.position.inside" %in% fn_fmls_names(theme)) {
337+
theme(legend.position = "inside", legend.position.inside = position)
338+
} else {
339+
theme(legend.position = position)
340+
}
337341
}
338342
#' @rdname bayesplot-helpers
339343
#' @export

R/mcmc-traces.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ mcmc_rank_hist <- function(x,
394394
# Otherwise, use a grid.
395395
if (n_param > 1) {
396396
facet_f <- facet_grid
397+
names(facet_args)[names(facet_args) == "facets"] <- "rows"
397398
} else {
398399
facet_f <- facet_wrap
399400
facet_args[["nrow"]] <- facet_args[["nrow"]] %||% 1

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ _J. R. Stat. Soc. A_, 182: 389-402. doi:10.1111/rssa.12378.
4343
* [Ask a question](https://discourse.mc-stan.org) (Stan Forums on Discourse)
4444
* [Open an issue](https://github.com/stan-dev/bayesplot/issues) (GitHub issues for bug reports, feature requests)
4545

46+
### Contributing
47+
48+
We are always looking for new contributors! See [CONTRIBUTING.md](https://github.com/stan-dev/bayesplot/blob/master/.github/CONTRIBUTING.md) for details and/or reach out via the issue tracker.
49+
4650
### Installation
4751

4852
* Install from CRAN:

tests/testthat/test-convenience-functions.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ test_that("legend_move returns correct theme object", {
110110

111111
pos <- legend_move(c(0.25, 0.5))
112112
expect_s3_class(pos, "theme")
113-
expect_equivalent(pos, list(legend.position = c(0.25, 0.5)))
113+
expect_equivalent(
114+
pos$legend.position.inside %||% pos$legend.position,
115+
c(0.25, 0.5)
116+
)
114117
expect_false(attr(pos, "complete"))
115118
})
116119
test_that("legend_text returns correct theme object", {

0 commit comments

Comments
 (0)