Pictorial bar chart is a type of bar chart that custimzed glyph (like images, SVG PathData) can be used instead of rectangular bar. This kind of chart is usually used in infographic.
Built-in symbols
y <- rnorm(10, 10, 2)
df <- data.frame(
x = 1:10,
y = y,
z = y - rnorm(10, 5, 1)
)
df |>
e_charts(x) |>
e_bar(z, barWidth = 10) |>
e_pictorial(y, symbol = "rect", symbolRepeat = TRUE, z = -1,
symbolSize = c(10, 4)) |>
e_theme("westeros") |>
e_title("Built-in symbols")
Icons
echarts4r.assets now includes icons you can easily include in your plots.
Images
qomo <- paste0(
"https://echarts.apache.org/examples/",
"data/asset/img/hill-Qomolangma.png"
)
kili <- paste0(
"https://echarts.apache.org/examples/",
"data/asset/img/hill-Kilimanjaro.png"
)
data <- data.frame(
x = c("Qomolangma", "Kilimanjaro"),
value = c(8844, 5895),
symbol = c(paste0("image://", qomo),
paste0("image://", kili))
)
data |>
e_charts(x) |>
e_pictorial(value, symbol) |>
e_legend(FALSE) |>
e_title("Images", "Mountains height")