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.
<!-- Include the CanvasXpress library in your HTML file --> <link rel="stylesheet" href="https://www.canvasxpress.org/dist/canvasXpress.css" type="text/css"/> <script src="https://www.canvasxpress.org/canvasXpress.min.js"></script> <!-- Create a canvas element for the chart with the desired dimensions --> <div> <canvas id="canvasId" width="600" height="600"</canvas> </div> <!-- Create a script to initialize the chart --> <script> <!-- Create the data for the graph --> var data = { "y" : { "data" : [ [102.5,51.3], [104.5,49.9], [100.4,50], [95.9,49.2], [87,48.5], [95,47.8], [88.6,47.3], [89.2,45.1], [78.9,46.3], [84.6,42.1], [81.7,44.2], [72.2,43.5], [65.1,42.3], [68.1,40.2], [67.3,31.8], [52.5,34] ], "smps" : ["Mortality","Temperature"], "vars" : ["s1","s2","s3","s4","s5","s6","s7","s8","s9","s10","s11","s12","s13","s14","s15","s16"] } } <-- Create the configuration for the graph --> var config = { "backgroundType":"window", "backgroundWindow":"rgb(238,238,238)", "citation":"Velleman, P. F. and Hoaglin, D. C. (1981).\\nApplications, Basics, and Computing of Exploratory Data Analysis. Belmont. CA: Wadsworth, Inc., pp. 127-134.", "colors":[ "rgba(64,64,64,0.5)" ], "decorationsBackgroundColor":"rgb(238,238,238)", "decorationsBorderColor":"rgb(0,0,0)", "decorationsPosition":"bottomRight", "graphType":"Scatter2D", "legendBackgroundColor":"rgba(255,255,255,0)", "legendInside":"true", "showDecorations":"true", "showRegressionFit":"true", "showTransition":"false", "theme":"CanvasXpress", "title":"Mean annual temperature (in degrees F) and Mortality Index for neoplasms of the female breast.", "xAxis":[ "Mortality" ], "xAxisTickColor":"rgb(255,255,255)", "yAxis":[ "Temperature" ], "yAxisTickColor":"rgb(255,255,255)" } <!-- Call the CanvasXpress function to create the graph --> var cX = new CanvasXpress("canvasId", data, config); </script>
library(canvasXpress) y=read.table("https://www.canvasxpress.org/data/cX-breastcancert-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) canvasXpress( data=y, backgroundType="window", backgroundWindow="rgb(238,238,238)", citation="Velleman, P. F. and Hoaglin, D. C. (1981).\nApplications, Basics, and Computing of Exploratory Data Analysis. Belmont. CA: Wadsworth, Inc., pp. 127-134.", colors=list("rgba(64,64,64,0.5)"), decorationsBackgroundColor="rgb(238,238,238)", decorationsBorderColor="rgb(0,0,0)", decorationsPosition="bottomRight", graphType="Scatter2D", legendBackgroundColor="rgba(255,255,255,0)", legendInside=TRUE, showDecorations=TRUE, showRegressionFit=TRUE, showTransition=FALSE, theme="CanvasXpress", title="Mean annual temperature (in degrees F) and Mortality Index for neoplasms of the female breast.", xAxis=list("Mortality"), xAxisTickColor="rgb(255,255,255)", yAxis=list("Temperature"), yAxisTickColor="rgb(255,255,255)" )