Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# bayesplot (development version)

* Remove y-axis line from density, histogram, dot, and frequency polygon plots where the y-axis has no meaningful scale (#418)
* Documentation added for all exported `*_data()` functions (#209)
* Improved documentation for `binwidth`, `bins`, and `breaks` arguments to clarify they are passed to `ggplot2::geom_area()` and `ggdist::stat_dots()` in addition to `ggplot2::geom_histogram()`
* Improved documentation for `freq` argument to clarify it applies to frequency polygons in addition to histograms
Expand Down
9 changes: 6 additions & 3 deletions R/mcmc-diagnostics-nuts.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ mcmc_nuts_acceptance <-
yaxis_text(FALSE) +
yaxis_title(FALSE) +
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank()) +
xaxis_title(FALSE)

scatter_data <- data.frame(
Expand Down Expand Up @@ -366,7 +367,8 @@ mcmc_nuts_treedepth <- function(x, lp, chain = NULL, ...) {
bayesplot_theme_get() +
yaxis_text(FALSE) +
yaxis_title(FALSE) +
yaxis_ticks(FALSE)
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank())

violin_lp_data <- data.frame(treedepth, lp = lp$Value)

Expand Down Expand Up @@ -491,15 +493,16 @@ mcmc_nuts_energy <-
theme(legend.text = element_text(size = rel(1.1))) +
yaxis_text(FALSE) +
yaxis_title(FALSE) +
yaxis_ticks(FALSE)
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank())

if (merge_chains) {
return(graph)
}

graph +
facet_wrap(vars(.data$Chain)) +
force_axes_in_facets()
force_x_axis_in_facets()
}


Expand Down
8 changes: 5 additions & 3 deletions R/mcmc-distributions.R
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ mcmc_dots_by_chain <- function(
}
graph <- graph +
do.call("facet_grid", facet_args) +
force_axes_in_facets()
force_x_axis_in_facets()
}

if (n_param == 1) {
Expand All @@ -528,6 +528,7 @@ mcmc_dots_by_chain <- function(
yaxis_text(FALSE) +
yaxis_title(FALSE) +
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank()) +
xaxis_title(on = n_param == 1)
}

Expand Down Expand Up @@ -644,9 +645,10 @@ mcmc_dots_by_chain <- function(
graph +
dont_expand_y_axis(c(0.005, 0)) +
bayesplot_theme_get() +
yaxis_text(FALSE) +
yaxis_ticks(FALSE) +
yaxis_text(on = violin) +
yaxis_ticks(on = violin) +
yaxis_title(on = n_param == 1 && violin) +
(if (!violin) theme(axis.line.y = element_blank()) else geom_ignore()) +
xaxis_title(on = n_param == 1)
}

Expand Down
19 changes: 12 additions & 7 deletions R/ppc-distributions.R
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ ppc_dens_overlay <-
yaxis_title(FALSE) +
xaxis_title(FALSE) +
yaxis_text(FALSE) +
yaxis_ticks(FALSE)
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank())
}


Expand Down Expand Up @@ -253,7 +254,7 @@ ppc_dens_overlay_grouped <- function(y,

p_overlay +
facet_wrap("group") +
force_axes_in_facets()
force_x_axis_in_facets()
}

#' @export
Expand Down Expand Up @@ -370,12 +371,13 @@ ppc_dens <-
scale_color_ppc() +
bayesplot_theme_get() +
facet_wrap_parsed("rep_label") +
force_axes_in_facets() +
force_x_axis_in_facets() +
dont_expand_y_axis() +
space_legend_keys() +
yaxis_text(FALSE) +
yaxis_title(FALSE) +
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank()) +
xaxis_title(FALSE) +
facet_text(FALSE) +
facet_bg(FALSE)
Expand Down Expand Up @@ -409,13 +411,14 @@ ppc_hist <-
scale_fill_ppc() +
scale_color_ppc() +
facet_wrap_parsed("rep_label") +
force_axes_in_facets() +
force_x_axis_in_facets() +
dont_expand_y_axis() +
bayesplot_theme_get() +
space_legend_keys() +
yaxis_text(FALSE) +
yaxis_title(FALSE) +
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank()) +
xaxis_title(FALSE) +
facet_text(FALSE) +
facet_bg(FALSE)
Expand Down Expand Up @@ -456,12 +459,13 @@ ppc_freqpoly <-
scale_color_ppc() +
facet_wrap_parsed("rep_label") +
bayesplot_theme_get() +
force_axes_in_facets() +
force_x_axis_in_facets() +
dont_expand_y_axis() +
space_legend_keys() +
yaxis_text(FALSE) +
yaxis_title(FALSE) +
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank()) +
xaxis_title(FALSE) +
facet_text(FALSE)
}
Expand All @@ -488,7 +492,7 @@ ppc_freqpoly_grouped <-
scales = "free",
labeller = label_parsed
) +
force_axes_in_facets() +
force_x_axis_in_facets() +
facet_text() +
theme(strip.text.y = element_blank())
}
Expand Down Expand Up @@ -562,12 +566,13 @@ ppc_dots <-
scale_fill_ppc() +
scale_color_ppc() +
facet_wrap_parsed("rep_label") +
force_axes_in_facets() +
force_x_axis_in_facets() +
bayesplot_theme_get() +
space_legend_keys() +
yaxis_text(FALSE) +
yaxis_title(FALSE) +
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank()) +
xaxis_title(FALSE) +
facet_text(FALSE) +
facet_bg(FALSE)
Expand Down
15 changes: 10 additions & 5 deletions R/ppd-distributions.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ ppd_dens_overlay <-
xaxis_title(FALSE) +
yaxis_text(FALSE) +
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank()) +
legend_none()
}

Expand Down Expand Up @@ -145,12 +146,13 @@ ppd_dens <-
scale_fill_ppd() +
bayesplot_theme_get() +
facet_wrap_parsed("rep_label") +
force_axes_in_facets() +
force_x_axis_in_facets() +
dont_expand_y_axis() +
legend_none() +
yaxis_text(FALSE) +
yaxis_title(FALSE) +
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank()) +
xaxis_title(FALSE) +
facet_text(FALSE)
}
Expand Down Expand Up @@ -183,12 +185,13 @@ ppd_hist <-
scale_fill_ppd() +
bayesplot_theme_get() +
facet_wrap_parsed("rep_label") +
force_axes_in_facets() +
force_x_axis_in_facets() +
dont_expand_y_axis() +
legend_none() +
yaxis_text(FALSE) +
yaxis_title(FALSE) +
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank()) +
xaxis_title(FALSE) +
facet_text(FALSE)
}
Expand Down Expand Up @@ -220,12 +223,13 @@ ppd_dots <-
scale_fill_ppd() +
bayesplot_theme_get() +
facet_wrap_parsed("rep_label") +
force_axes_in_facets() +
force_x_axis_in_facets() +
dont_expand_y_axis() +
legend_none() +
yaxis_text(FALSE) +
yaxis_title(FALSE) +
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank()) +
xaxis_title(FALSE) +
facet_text(FALSE)
}
Expand Down Expand Up @@ -265,11 +269,12 @@ ppd_freqpoly <-
scale_color_ppd() +
scale_fill_ppd() +
bayesplot_theme_get() +
force_axes_in_facets() +
force_x_axis_in_facets() +
dont_expand_y_axis() +
yaxis_text(FALSE) +
yaxis_title(FALSE) +
yaxis_ticks(FALSE) +
theme(axis.line.y = element_blank()) +
xaxis_title(FALSE) +
facet_text(FALSE) +
legend_none()
Expand Down Expand Up @@ -297,7 +302,7 @@ ppd_freqpoly_grouped <-
scales = "free",
labeller = label_parsed
) +
force_axes_in_facets() +
force_x_axis_in_facets() +
facet_text() +
theme(strip.text.y = element_blank())
}
Expand Down
5 changes: 0 additions & 5 deletions tests/testthat/_snaps/mcmc-distributions/mcmc-dens-alpha.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions tests/testthat/_snaps/mcmc-distributions/mcmc-dens-bounds.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions tests/testthat/_snaps/mcmc-distributions/mcmc-hist-alpha.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new figure seems still to have y-axis line

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading