Customized Three-Column Dataset Visualization
Contour graphs, also known as contour plots, are visual representations of three-dimensional (3D) surfaces in two dimensions (2D). They are useful for depicting functions of two variables, showing regions of constant value. These graphs use lines, called contour lines or isolines, to connect points of equal value on the surface. Applications span diverse fields like geography (topographic maps), meteorology (weather maps showing isobars), and engineering (design optimization). Understanding contour graphs enhances data interpretation and analysis across various disciplines.
<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>
// Use a data frame (2D-array) for the graph
var data = [
[ "Id", "s1", "s2", "s3"],
[ "v1", -9, 0, 10],
[ "v2", -9, 1, 5.625],
[ "v3", -9, 4, 2.5],
[ "v4", -9, 5, 0.625],
[ "v5", -9, 7, 0],
[ "v6", -6, 0, 10.625],
[ "v7", -6, 1, 6.25],
[ "v8", -6, 4, 3.125],
[ "v9", -6, 5, 1.25],
[ "v10", -6, 7, 0.625],
[ "v11", -5, 0, 12.5],
[ "v12", -5, 1, 8.125],
[ "v13", -5, 4, 5],
[ "v14", -5, 5, 3.125],
[ "v15", -5, 7, 2.5],
[ "v16", -3, 0, 15.625],
[ "v17", -3, 1, 11.25],
[ "v18", -3, 4, 8.125],
[ "v19", -3, 5, 6.25],
[ "v20", -3, 7, 5.625],
[ "v21", -1, 0, 20],
[ "v22", -1, 1, 15.625],
[ "v23", -1, 4, 12.5],
[ "v24", -1, 5, 10.625],
[ "v25", -1, 7, 10 ]
];
// Create the configuration for the graph
var config = {
"contourFilled" : true,
"contourType" : "normal",
"graphType" : "ScatterBubble2D",
"title" : "Custom Contour Plot",
"xAxis" : ["s1"],
"yAxis" : ["s2"],
"zAxis" : ["s3"]
}
// 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);
// Functions after rendering graph
cX.createContour();
</script>
</body>
</html>
<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" : [
[-9,0,10],
[-9,1,5.625],
[-9,4,2.5],
[-9,5,0.625],
[-9,7,0],
[-6,0,10.625],
[-6,1,6.25],
[-6,4,3.125],
[-6,5,1.25],
[-6,7,0.625],
[-5,0,12.5],
[-5,1,8.125],
[-5,4,5],
[-5,5,3.125],
[-5,7,2.5],
[-3,0,15.625],
[-3,1,11.25],
[-3,4,8.125],
[-3,5,6.25],
[-3,7,5.625],
[-1,0,20],
[-1,1,15.625],
[-1,4,12.5],
[-1,5,10.625],
[-1,7,10]
],
"smps" : ["s1","s2","s3"],
"vars" : ["v1","v2","v3","v4","v5","v6","v7","v8","v9","v10","v11","v12","v13","v14","v15","v16","v17","v18","v19","v20","v21","v22","v23","v24","v25"]
}
}
// Create the configuration for the graph
var config = {
"contourFilled" : true,
"contourType" : "normal",
"graphType" : "ScatterBubble2D",
"title" : "Custom Contour Plot",
"xAxis" : ["s1"],
"yAxis" : ["s2"],
"zAxis" : ["s3"]
}
// 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);
// Functions after rendering graph
cX.createContour();
</script>
</body>
</html>
library(canvasXpress)
y=read.table("https://www.canvasxpress.org/data/r/cX-contour3-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
data=y,
contourFilled=TRUE,
contourType="normal",
graphType="ScatterBubble2D",
title="Custom Contour Plot",
xAxis=list("s1"),
yAxis=list("s2"),
zAxis=list("s3"),
afterRender=list(list("createContour"))
)





