<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 =
// Create the configuration for the graph
var config = {
"graphType" : "Boxplot",
"graphOrientation" : "vertical",
"groupingFactors" : [
"group"
],
"xAxis" : [
"weight"
],
"xAxisTitle" : "weight",
"smpTitle" : "group",
"smpTitleFontStyle" : "bold",
"axisTitleFontStyle" : "bold",
"axisAlgorithm" : "rPretty",
"smpTextRotate" : 0,
"showLegend" : false,
"colorBy" : "group",
"title" : "PlantGrowth: dried weight by treatment (Welch t-test)",
"showStatInference" : true,
"statInference" : {
"annotate" : "p",
"comparisons" : [
{
"groups" : [
"trt1",
"trt2"
],
"p" : 0.00929840471726985,
"value" : 7.0
}
]
},
"showBoxplotOriginalData" : true,
"jitter" : true,
"colorScheme" : "Tableau"
}
// 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);
</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" : {
"vars" : [
"weight"
],
"smps" : [
"Obs1",
"Obs2",
"Obs3",
"Obs4",
"Obs5",
"Obs6",
"Obs7",
"Obs8",
"Obs9",
"Obs10",
"Obs11",
"Obs12",
"Obs13",
"Obs14",
"Obs15",
"Obs16",
"Obs17",
"Obs18",
"Obs19",
"Obs20",
"Obs21",
"Obs22",
"Obs23",
"Obs24",
"Obs25",
"Obs26",
"Obs27",
"Obs28",
"Obs29",
"Obs30"
],
"data" : [
[
4.17,
5.58,
5.18,
6.11,
4.5,
4.61,
5.17,
4.53,
5.33,
5.14,
4.81,
4.17,
4.41,
3.59,
5.87,
3.83,
6.03,
4.89,
4.32,
4.69,
6.31,
5.12,
5.54,
5.5,
5.37,
5.29,
4.92,
6.15,
5.8,
5.26
]
]
},
"x" : {
"group" : [
"ctrl",
"ctrl",
"ctrl",
"ctrl",
"ctrl",
"ctrl",
"ctrl",
"ctrl",
"ctrl",
"ctrl",
"trt1",
"trt1",
"trt1",
"trt1",
"trt1",
"trt1",
"trt1",
"trt1",
"trt1",
"trt1",
"trt2",
"trt2",
"trt2",
"trt2",
"trt2",
"trt2",
"trt2",
"trt2",
"trt2",
"trt2"
]
}
}
// Create the configuration for the graph
var config = {
"graphType" : "Boxplot",
"graphOrientation" : "vertical",
"groupingFactors" : [
"group"
],
"xAxis" : [
"weight"
],
"xAxisTitle" : "weight",
"smpTitle" : "group",
"smpTitleFontStyle" : "bold",
"axisTitleFontStyle" : "bold",
"axisAlgorithm" : "rPretty",
"smpTextRotate" : 0,
"showLegend" : false,
"colorBy" : "group",
"title" : "PlantGrowth: dried weight by treatment (Welch t-test)",
"showStatInference" : true,
"statInference" : {
"annotate" : "p",
"comparisons" : [
{
"groups" : [
"trt1",
"trt2"
],
"p" : 0.00929840471726985,
"value" : 7.0
}
]
},
"showBoxplotOriginalData" : true,
"jitter" : true,
"colorScheme" : "Tableau"
}
// 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);
</script>
</body>
</html>
library(canvasXpress)
y=read.table("https://www.canvasxpress.org/data/r/cX-statistics1-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/r/cX-statistics1-smp.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
data=y,
smpAnnot=x,
axisAlgorithm="rPretty",
axisTitleFontStyle="bold",
colorBy="group",
colorScheme="Tableau",
graphOrientation="vertical",
graphType="Boxplot",
groupingFactors=list("group"),
jitter=TRUE,
showBoxplotOriginalData=TRUE,
showLegend=FALSE,
showStatInference=TRUE,
smpTextRotate=0,
smpTitle="group",
smpTitleFontStyle="bold",
statInference=list(annotate="p", comparisons=list(list(groups=list("trt1", "trt2"), p=0.00929840471726985, value=7.0))),
title="PlantGrowth: dried weight by treatment (Welch t-test)",
xAxis=list("weight"),
xAxisTitle="weight"
)
from canvasxpress.canvas import CanvasXpress
from canvasxpress.plot import show_in_browser
if __name__ == "__main__":
# Define the chart with its data and configuration
chart: CanvasXpress = CanvasXpress(
render_to = "statistics1",
data = {
"y": {
"vars": ["weight"],
"smps": ["Obs1", "Obs2", "Obs3", "Obs4", "Obs5", "Obs6", "Obs7", "Obs8", "Obs9", "Obs10", "Obs11", "Obs12", "Obs13", "Obs14", "Obs15", "Obs16", "Obs17", "Obs18", "Obs19", "Obs20", "Obs21", "Obs22", "Obs23", "Obs24", "Obs25", "Obs26", "Obs27", "Obs28", "Obs29", "Obs30"],
"data": [
[4.17, 5.58, 5.18, 6.11, 4.5, 4.61, 5.17, 4.53, 5.33, 5.14, 4.81, 4.17, 4.41, 3.59, 5.87, 3.83, 6.03, 4.89, 4.32, 4.69, 6.31, 5.12, 5.54, 5.5, 5.37, 5.29, 4.92, 6.15, 5.8, 5.26]
]
},
"x": {
"group": ["ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2"]
}
},
config = {
"graphType": "Boxplot",
"graphOrientation": "vertical",
"groupingFactors": ["group"],
"xAxis": ["weight"],
"xAxisTitle": "weight",
"smpTitle": "group",
"smpTitleFontStyle": "bold",
"axisTitleFontStyle": "bold",
"axisAlgorithm": "rPretty",
"smpTextRotate": 0,
"showLegend": False,
"colorBy": "group",
"title": "PlantGrowth: dried weight by treatment (Welch t-test)",
"showStatInference": True,
"statInference": {
"annotate": "p",
"comparisons": [
{
"groups": ["trt1", "trt2"],
"p": 0.00929840471726985,
"value": 7.0
}
]
},
"showBoxplotOriginalData": True,
"jitter": True,
"colorScheme": "Tableau"
},
width = 600,
height = 600
)
# Display the chart in its own Web page
show_in_browser(chart)
Run this notebook:
from canvasxpress.canvas import CanvasXpress
from canvasxpress.plot import graph
graph(
CanvasXpress(
render_to = "statistics1",
data = {
"y": {
"vars": ["weight"],
"smps": ["Obs1", "Obs2", "Obs3", "Obs4", "Obs5", "Obs6", "Obs7", "Obs8", "Obs9", "Obs10", "Obs11", "Obs12", "Obs13", "Obs14", "Obs15", "Obs16", "Obs17", "Obs18", "Obs19", "Obs20", "Obs21", "Obs22", "Obs23", "Obs24", "Obs25", "Obs26", "Obs27", "Obs28", "Obs29", "Obs30"],
"data": [
[4.17, 5.58, 5.18, 6.11, 4.5, 4.61, 5.17, 4.53, 5.33, 5.14, 4.81, 4.17, 4.41, 3.59, 5.87, 3.83, 6.03, 4.89, 4.32, 4.69, 6.31, 5.12, 5.54, 5.5, 5.37, 5.29, 4.92, 6.15, 5.8, 5.26]
]
},
"x": {
"group": ["ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2"]
}
},
config = {
"graphType": "Boxplot",
"graphOrientation": "vertical",
"groupingFactors": ["group"],
"xAxis": ["weight"],
"xAxisTitle": "weight",
"smpTitle": "group",
"smpTitleFontStyle": "bold",
"axisTitleFontStyle": "bold",
"axisAlgorithm": "rPretty",
"smpTextRotate": 0,
"showLegend": False,
"colorBy": "group",
"title": "PlantGrowth: dried weight by treatment (Welch t-test)",
"showStatInference": True,
"statInference": {
"annotate": "p",
"comparisons": [
{
"groups": ["trt1", "trt2"],
"p": 0.00929840471726985,
"value": 7.0
}
]
},
"showBoxplotOriginalData": True,
"jitter": True,
"colorScheme": "Tableau"
},
width = 600,
height = 600
)
)
using CanvasXpress
canvasxpress(Dict(
"y" => Dict(
"vars" => ["weight"],
"smps" => ["Obs1", "Obs2", "Obs3", "Obs4", "Obs5", "Obs6", "Obs7", "Obs8", "Obs9", "Obs10", "Obs11", "Obs12", "Obs13", "Obs14", "Obs15", "Obs16", "Obs17", "Obs18", "Obs19", "Obs20", "Obs21", "Obs22", "Obs23", "Obs24", "Obs25", "Obs26", "Obs27", "Obs28", "Obs29", "Obs30"],
"data" => [
[4.17, 5.58, 5.18, 6.11, 4.5, 4.61, 5.17, 4.53, 5.33, 5.14, 4.81, 4.17, 4.41, 3.59, 5.87, 3.83, 6.03, 4.89, 4.32, 4.69, 6.31, 5.12, 5.54, 5.5, 5.37, 5.29, 4.92, 6.15, 5.8, 5.26]
]
),
"x" => Dict(
"group" => ["ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "ctrl", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt1", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2", "trt2"]
)
);
graphType = "Boxplot",
graphOrientation = "vertical",
groupingFactors = ["group"],
xAxis = ["weight"],
xAxisTitle = "weight",
smpTitle = "group",
smpTitleFontStyle = "bold",
axisTitleFontStyle = "bold",
axisAlgorithm = "rPretty",
smpTextRotate = 0,
showLegend = false,
colorBy = "group",
title = "PlantGrowth: dried weight by treatment (Welch t-test)",
showStatInference = true,
statInference = Dict(
"annotate" => "p",
"comparisons" => [
Dict(
"groups" => ["trt1", "trt2"],
"p" => 0.00929840471726985,
"value" => 7.0
)
]
),
showBoxplotOriginalData = true,
jitter = true,
colorScheme = "Tableau"
)