Scatter2D graphs are a fundamental visualization tool used to display the relationship between two numerical variables. Each data point is represented as a dot on a two-dimensional plane, where the x-coordinate and y-coordinate correspond to the values of the two variables. This allows for quick identification of trends, clusters, and outliers in the data. Applications range from scientific data analysis to business intelligence, making them highly versatile. Creating effective Scatter2D graphs involves careful consideration of axis scaling, labeling, and color-coding. Highlighting specific data points or regions can improve understanding. Interactive Scatter2D plots further enhance exploration, allowing users to zoom, pan, and select individual data points for detailed examination. Choosing appropriate visualization tools greatly impacts the ability to draw meaningful insights from data.
<html> <head> <!-- 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/dist/canvasXpress.min.js"></script> </head> <body> <!-- 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" : "panel", "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, "panelBackgroundColor" : "rgb(238,238,238)", "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"], "xAxisGridMajorColor" : "rgb(255,255,255)", "yAxis" : ["Temperature"], "yAxisGridMajorColor" : "rgb(255,255,255)" } // Event used to create graph (optional) var events = false // Call the CanvasXpress function to create the graph var cX = new CanvasXpress("canvasId", data, config, events); </script> </body> </html>
library(canvasXpress) y=read.table("https://www.canvasxpress.org/data/r/cX-breastcancert-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) canvasXpress( data=y, backgroundType="panel", 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, panelBackgroundColor="rgb(238,238,238)", 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"), xAxisGridMajorColor="rgb(255,255,255)", yAxis=list("Temperature"), yAxisGridMajorColor="rgb(255,255,255)" )