Lollipop Chart

A lollipop plot is basically a barplot, where the bar is transformed in a line and a dot. It shows the relationship between a numeric and a categoric variable. However it is more appealing and convey as well the information. It is especially useful when you have several bars of the same height: it avoids to have a cluttered figure and a Moiré effect. The Cleveland dot plot is a handy variation, allowing to compare the value of 2 numeric values for each group.



Color Themes


{
   "y" : {
      "data" : [
        [10,15,20,30,40,70,80,90]
      ],
      "smps" : ["S1","S2","S3","S4","S5","S6","S7","S8"],
      "vars" : ["V1"]
   }
}
{
   "barLollipopFactor":"3",
   "barType":"lollipop",
   "colorScheme":"CanvasXpress",
   "graphType":"Bar",
   "legendKeyBackgroundBorderColor":"rgba(0,0,0,0)",
   "legendKeyBackgroundColor":"rgba(0,0,0,0)",
   "showTransition":"false",
   "widthFactor":0.1
}
library(canvasXpress)
y=read.table("https://www.canvasxpress.org/data/cX-lollipop-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
  data=y,
  barLollipopFactor=3,
  barType="lollipop",
  colorScheme="CanvasXpress",
  graphType="Bar",
  legendKeyBackgroundBorderColor="rgba(0,0,0,0)",
  legendKeyBackgroundColor="rgba(0,0,0,0)",
  showTransition=FALSE,
  widthFactor=0.1
)