Learn R Programming

daltoolbox (version 1.2.747)

plot_hist: Plot histogram

Description

Histogram for a numeric column using ggplot2.

Usage

plot_hist(data, label_x = "", label_y = "", color = "white", alpha = 0.25)

Value

returns a ggplot2::ggplot graphic

Arguments

data

data.frame with one numeric column (first column is used if multiple)

label_x

x‑axis label

label_y

y‑axis label

color

fill color

alpha

transparency level (0–1)

Details

If multiple columns are provided, only the first is used. Breaks are computed via graphics::hist to mirror base R binning. color controls the fill; alpha the transparency.

Examples

Run this code
grf <- plot_hist(iris |> dplyr::select(Sepal.Width), color=c("blue"))
plot(grf)

Run the code above in your browser using DataLab