knitr::opts_chunk$set( collapse = TRUE, warning = FALSE, message = FALSE, fig.align='center', fig.width=7, fig.height=5, comment = "#>" )
Used to compare the position or performance of multiple items with respect to each other. Actual values matters somewhat less than the ranking.
Lollipop chart sebenarnya hampir sama dengan bar chart. Namun salah satu kelebihannya adalah plot menjadi tidak terlalu penuh, karena direprsentasikan dengan point dan garis saja. Berikut adalah contohnya.
library(dataplot) library(ggplot2) df <- data.frame( "brand" = c("Samsung", "Huawei", "Apple", "Xiaomi", "OPPO"), "share" = c(10, 30, 20, 35, 5) ) plot_lollipop(data = df, x = "brand", y = "share", title = "Lorem Ipsum is simply dummy text", subtitle = "Contrary to popular belief, Lorem Ipsum is not simply random text", data_source = "www.kedata.online" )
Dumbbell charts are a great tool if you wish to:
library(dataplot) s <- read.csv("https://raw.githubusercontent.com/plotly/datasets/master/school_earnings.csv") s$School <- factor(s$School, levels = s$School[order(s$Men)]) plot_dumbbell(data = s, cat = "School", x1 = "Women", x2 = "Men", size = 3, x_title = "Salary", y_title = "School", title = "Gender earnings disparity", subtitle = "Gender earnings disparity from Women VS Men based on University", data_source = "www.kedata.online")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.