qbin_barplot() shows the median or mean for each quantile bin, thereby focusing on the expected value per qbin(). For a conditional plot, see cond_barplot().

qbin_barplot(
  data,
  x = NULL,
  n = 100,
  min_bin_size = NULL,
  overlap = NULL,
  ncols = NULL,
  fill = "#2f4f4f",
  type = c("median", "mean"),
  ...
)

table_plot(data, x = NULL, n = 100, ncols = ncol(data), fill = "#555555", ...)

Arguments

data

a data.frame to be binned

x

character variable name used for the quantile binning

n

integer number of quantile bins.

min_bin_size

integer minimum number of rows/data points that should be in a quantile bin. If NULL it is initially sqrt(nrow(data))

overlap

logical if TRUE the quantile bins will overlap. Default value will be FALSE.

ncols

The number of column to be used in the layout.

fill

The color to use for the bars.

type

The type of statistic to use for the bars.

...

Additional arguments to pass to the plot functions

Value

A list of ggplot objects.

Details

The table_plot is a specific form of qbin_barplot with ncols set to ncol(data).

See also

Other qbin plotting functions: qbin_boxplot(), qbin_heatmap(), qbin_lineplot()

Examples

# \donttest{
  data("diamonds", package="ggplot2")

  table_plot(diamonds[c(1:4, 7)], "carat")


  qbin_barplot(iris, "Sepal.Length", n = 12)


  table_plot(iris, "Sepal.Length", n=12)

  table_plot(
    iris,
    x = "Sepal.Length",
    min_bin_size=20,
    overlap=TRUE
  )


  if (require(palmerpenguins)) {
    table_plot(penguins[1:7], "body_mass_g", 19)
  }

# }