Class method leem for generic barplot
Arguments
- height
R object (list) of class leem. Use
new_leem()function.- freq
Character argument. Type of frequency with options:
"a"(absolute and default),"r"relative and"p"percentage.- bg
Logical argument. Default is
TRUE, it displays the background, andbg = FALSEotherwise.- main
Character argument. Insert the plot title. The default is
NULL.- xlab
Character argument. Insert the title of the x-axis graphic label. The default is
NULL.- ylab
Character argument. Insert the title of the y-axis graphic label. The default is
NULL.- grids
Insert grids to plot. The default is
grid(col = "white").- bgcol
Insert the background color. This argument is only valid when
bg = TRUE. The default isbgcol="gray".- bgborder
Character argument. Insert the background border color. This argument is only valid when
bg = TRUE. The default is bgborder = NA.- barcol
Character argument. Insert the barplot color. The default is
barcol = "yellow". This argument is only valid whenbars = TRUE.- barborder
Numeric argument. Insert the barplot border color. This argument is only valid when
bars = TRUE. The default is barborder = "gray".- posx1
Numeric argument.Distance of the labels (horizontal) in relation to the x axis.
- posx2
Numeric argument.Distance of the labels (vertical) in relation to the x axis.
- xang
Numeric argument.Angle of the labels in relation to the x axis
- labels
Character argument. Labels name vector.
- ...
further arguments passed to or from other methods.
Examples
library(graphics)
# Example 1 - Simple example
library(leem)
rep(1:5, 5:1) |>
new_leem() |>
barplot()
# Example 2 - Color bars
rep(1:5, 5:1) |>
new_leem() |>
barplot(barcol = heat.colors(5))
# Example 3 - Ordered data
library(leem)
school <- rep(c("high", "university", "basic"), 3:5)
sample(school, 30, TRUE) |>
new_leem() |>
tabfreq(ordered = c("basic", "high", "university")) |>
barplot(xang = 15, posx2 = -0.2)
# Example 4 - Coerced to histogram
rnorm(100, 10, 2) |>
new_leem(variable = 2) |>
barplot(barcol = heat.colors(10))
#> Warning: Coerced to histogram!
