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" : [ [0.0009,172], [0.0018,177], [0.0037,160], [0.0073,166], [0.0146,211], [0.0293,248], [0.0586,269], [0.117,283], [0.234,298], [0.469,314], [0.938,328], [1.88,316] ], "smps" : ["Concentration","V1"], "vars" : ["S1","S2","S3","S4","S5","S6","S7","S8","S9","S10","S11","S12"] } } <-- Create the configuration for the graph --> var config = { "decorations":{ "nlfit":[ { "label":"Custom Fit", "param":[ "164", "313", 0.031, -1.5, 1.2e-06, 1.9 ], "type":"cst" }, { "label":"Regular Fit", "param":[ "164", "313", 0.031, 1.5, 1.2e-06, 1.9 ], "type":"reg" } ] }, "graphType":"Scatter2D", "setMaxY":"350", "setMinY":"100", "showDecorations":"true", "theme":"CanvasXpress", "xAxis":[ "Concentration" ], "xAxisTransform":"log10", "xAxisTransformTicks":"true", "yAxis":[ "V1" ], "yAxisExact":"true" } <!-- 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-nonlinearfit-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) canvasXpress( data=y, decorations=list(nlfit=list(list(label="Custom Fit", param=list(164, 313, 0.031, -1.5, 1.2e-06, 1.9), type="cst"), list(label="Regular Fit", param=list(164, 313, 0.031, 1.5, 1.2e-06, 1.9), type="reg"))), graphType="Scatter2D", setMaxY=350, setMinY=100, showDecorations=TRUE, theme="CanvasXpress", xAxis=list("Concentration"), xAxisTransform="log10", xAxisTransformTicks=TRUE, yAxis=list("V1"), yAxisExact=TRUE )