Contour Chart

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.


Example Color Themes

Example Fonts



Show Code

Tools

<!-- 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" : [
          [-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"
  }
  

  <!-- 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-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",
  afterRender=list(list("createContour"))
)