Scatter2D Chart

A scatterplot displays the relationship between 2 numeric variables. For each data point, the value of its first variable is represented on the X axis, the second on the Y axis.



Color Themes


{
   "m" : {
      "Description" : "Average weekly household spending, in British pounds, on tobacco products and alcoholic beverages for each of the 11 regions of Great Britain.",
      "Name" : "Alcohol Tobacco",
      "Reference" : "Moore, David S., and George P. McCabe (1989). Introduction to the Practice of Statistics, p. 179. Original source  :  Family Expenditure Survey, Department of Employment, 1981 (British official statistics)"
   },
   "x" : {
      "Description" : ["Average weekly household spending on alcoholic beverages in pounds","Average weekly household spending on tobacco products in pounds"]
   },
   "y" : {
      "data" : [
        [6.47,4.03],
        [6.13,3.76],
        [6.19,3.77],
        [4.89,3.34],
        [5.63,3.47],
        [4.52,2.92],
        [5.89,3.2],
        [4.79,2.71],
        [3.53,3.53],
        [6.08,4.51],
        [4.02,4.56]
      ],
      "smps" : ["Alcohol","Tobacco"],
      "vars" : ["North","Yorkshire","Northeast","East Midlands","West Midlands","East Anglia","Southeast","Southwest","Wales","Scotland","Northern Ireland"]
   }
}
{
   "citation" : "Moore, David S., and George P. McCabe (1989). Introduction to the Practice of Statistics, p. 179.",
   "decorations" : {
      "marker" : [{"sample" : ["Alcohol","Tobacco"],
            "text" : "Maybe an Outlier?",
            "variable" : "Northern Ireland",
            "x" : 0.45,
            "y" : 0.18
         }
      ]
   },
   "graphType" : "Scatter2D",
   "showTransition" : "false",
   "theme" : "CanvasXpress",
   "title" : "Average weekly household spending, in British pounds, on tobacco products\\nand alcoholic beverages for each of the 11 regions of Great Britain.",
   "xAxis" : ["Alcohol"],
   "yAxis" : ["Tobacco"]
}
library(canvasXpress)
y=read.table("https://www.canvasxpress.org/data/cX-alcoholtobaccot-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
x=read.table("https://www.canvasxpress.org/data/cX-alcoholtobaccot-smp.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
  data=y,
  smpAnnot=x,
  citation="Moore, David S., and George P. McCabe (1989). Introduction to the Practice of Statistics, p. 179.",
  decorations=list(marker=list(list(sample=list("Alcohol", "Tobacco"), text="Maybe an Outlier?", variable="Northern Ireland", x=0.45, y=0.18))),
  graphType="Scatter2D",
  showTransition=FALSE,
  theme="CanvasXpress",
  title="Average weekly household spending, in British pounds, on tobacco products\nand alcoholic beverages for each of the 11 regions of Great Britain.",
  xAxis=list("Alcohol"),
  yAxis=list("Tobacco")
)