Contour plots are graphs to show a three-dimensional surface on a two-dimensional plane. It graphs the X, Y variables on the plane axis and a response variable Z as contours. The format of the data can be specified as a three column x, y, z (long and skiny) data set or as rows and columns (short and fat) specifying the z value.
<!-- 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" : [ [20,15.625,12.5,10.625,10], [15.625,11.25,8.125,6.25,5.625], [12.5,8.125,5,3.125,2.5], [10.625,6.25,3.125,1.25,0.625], [10,5.625,2.5,0.625,0] ], "smps" : ["s1","s2","s3","s4","s5"], "vars" : ["v1","v2","v3","v4","v5"] } } <-- Create the configuration for the graph --> var config = { "contourType":"normal", "graphType":"Heatmap", "heatmapCellBox":"false", "showSampleNames":"false", "showVariableNames":"false", "title":"Basic Contour Plot" } <!-- Call the CanvasXpress function to create the graph --> var cX = new CanvasXpress("canvasId", data, config); <-- Functions after rendering graph --> cX.createContour(); </script>
library(canvasXpress) y=read.table("https://www.canvasxpress.org/data/cX-contour-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) canvasXpress( data=y, contourType="normal", graphType="Heatmap", heatmapCellBox=FALSE, showSampleNames=FALSE, showVariableNames=FALSE, title="Basic Contour Plot", afterRender=list(list("createContour")) )
Create New Page