A way to plot all the metadata associated with a dataset.
<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 = { "x" : { "Age" : [23,43,43,32,15,37,26,35,26,31,35,55,25,39,25,26,33,62,54,38,65], "Opinion" : ["pos","neg","pos","neg","neg","pos","pos","pos","pos","indiff","pos","indiff","pos","indiff","indiff","pos","neg","neg","pos","neg","neg"], "Order" : ["1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1","2","1"], "Sex" : ["M","F","M","M","M","F","F","F","M","F","F","F","F","M","M","M","M","M","F","F","M"], "Smoker" : ["N","Y","N","N","N","Y","N","N","N","N","Y","Y","Y","Y","N","N","Y","N","Y","N","N"] }, "y" : { "data" : [ [38.4,46.2,72.5,38,82.8,33.9,50.4,35,32.8,60.1,75.1,57.6,55.5,49.5,40.9,44.3,93.8,47.9,75.2,46.2,56.3], [27.7,57.2,57.9,38,57.9,32,40.6,33.1,26.8,53.2,63.1,57.7,63.3,45.8,35.7,46.8,91.9,59.9,54.1,39.3,45.8], [25.7,41.9,51.9,32.2,64.7,31.4,40.1,43.2,33.9,40.4,58,61.5,44.6,35.3,37.2,39.4,77.4,52.8,63.6,56.6,58.9], [53.1,54.7,74.2,49.6,53.6,51.3,44.1,34,34.5,59.1,67.3,75.5,41.1,52.2,28.3,74.9,77.5,50.9,70.1,60.3,59.9], [30.6,43.3,53.4,37.4,48.6,35.5,46.9,26.4,25.1,87.1,43.8,126.6,41.8,53.8,26,45.3,55.8,58.6,44,47.8,36.8], [30.2,56.7,42.4,34.4,44.8,42.9,42.7,24.8,25.1,59.2,42.2,48.4,32,48.1,33.7,42.6,54.9,64.5,43.1,52.8,44.3] ], "desc" : ["time in seconds"], "smps" : ["s1","s2","s3","s4","s5","s6","s7","s8","s9","s10","s11","s12","s13","s14","s15","s16","s17","s18","s19","s20","s21"], "vars" : ["U-Trial 1","U-Trial 2","U-Trial 3","S-Trial 1","S-Trial 2","S-Trial 3"] } } // Create the configuration for the graph var config = { "graphOrientation":"vertical", "graphType":"Boxplot", "histogramBins":false, "showTransition":false, "smpTextRotate":"90", "smpTitle":"Smoking Status", "theme":"lastAirBenderWater" } // Call the CanvasXpress function to create the graph var cX = new CanvasXpress("canvasId", data, config); // Functions after rendering graph cX.groupSamples(["Smoker"]); cX.createDOE(); </script> </body>
library(canvasXpress) y=read.table("https://www.canvasxpress.org/data/cX-scents-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) x=read.table("https://www.canvasxpress.org/data/cX-scents-smp.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) canvasXpress( data=y, smpAnnot=x, graphOrientation="vertical", graphType="Boxplot", histogramBins=FALSE, showTransition=FALSE, smpTextRotate=90, smpTitle="Smoking Status", theme="lastAirBenderWater", afterRender=list(list("groupSamples", list("Smoker")), list("createDOE")) )