Auto-stacked brackets with Holm correction


Economist GGPlot Excel Paul Tol Black And White Solarized Stata Tableau Wall Street CanvasXpress
<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" : [
            "tension"
         ],
         "xAxis" : [
            "breaks"
         ],
         "xAxisTitle" : "breaks",
         "smpTitle" : "tension",
         "smpTitleFontStyle" : "bold",
         "axisTitleFontStyle" : "bold",
         "axisAlgorithm" : "rPretty",
         "smpTextRotate" : 0,
         "showLegend" : false,
         "colorBy" : "tension",
         "title" : "Wool breaks by tension (Welch t-test, Holm-adjusted)",
         "showStatInference" : true,
         "statInference" : {
            "correction" : {
               "method" : "holm"
            },
            "annotate" : "stars",
            "comparisons" : [
               {
                  "groups" : [
                     "1 Low",
                     "2 Medium"
                  ],
                  "p" : 0.0325248132736696
               },
               {
                  "groups" : [
                     "2 Medium",
                     "3 High"
                  ],
                  "p" : 0.114557102318147
               },
               {
                  "groups" : [
                     "1 Low",
                     "3 High"
                  ],
                  "p" : 0.0023267944377645
               }
            ]
         },
         "showBoxplotOriginalData" : true,
         "jitter" : true,
         "colorScheme" : "Set1"
      }

      // 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" : [
               "breaks"
            ],
            "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",
               "Obs31",
               "Obs32",
               "Obs33",
               "Obs34",
               "Obs35",
               "Obs36",
               "Obs37",
               "Obs38",
               "Obs39",
               "Obs40",
               "Obs41",
               "Obs42",
               "Obs43",
               "Obs44",
               "Obs45",
               "Obs46",
               "Obs47",
               "Obs48",
               "Obs49",
               "Obs50",
               "Obs51",
               "Obs52",
               "Obs53",
               "Obs54"
            ],
            "data" : [
               [
                  26,
                  30,
                  54,
                  25,
                  70,
                  52,
                  51,
                  26,
                  67,
                  27,
                  14,
                  29,
                  19,
                  29,
                  31,
                  41,
                  20,
                  44,
                  18,
                  21,
                  29,
                  17,
                  12,
                  18,
                  35,
                  30,
                  36,
                  42,
                  26,
                  19,
                  16,
                  39,
                  28,
                  21,
                  39,
                  29,
                  36,
                  21,
                  24,
                  18,
                  10,
                  43,
                  28,
                  15,
                  26,
                  20,
                  21,
                  24,
                  17,
                  13,
                  15,
                  15,
                  16,
                  28
               ]
            ]
         },
         "x" : {
            "tension" : [
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "1 Low",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "2 Medium",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High",
               "3 High"
            ]
         }
      }

      // Create the configuration for the graph
      var config = {
         "graphType" : "Boxplot",
         "graphOrientation" : "vertical",
         "groupingFactors" : [
            "tension"
         ],
         "xAxis" : [
            "breaks"
         ],
         "xAxisTitle" : "breaks",
         "smpTitle" : "tension",
         "smpTitleFontStyle" : "bold",
         "axisTitleFontStyle" : "bold",
         "axisAlgorithm" : "rPretty",
         "smpTextRotate" : 0,
         "showLegend" : false,
         "colorBy" : "tension",
         "title" : "Wool breaks by tension (Welch t-test, Holm-adjusted)",
         "showStatInference" : true,
         "statInference" : {
            "correction" : {
               "method" : "holm"
            },
            "annotate" : "stars",
            "comparisons" : [
               {
                  "groups" : [
                     "1 Low",
                     "2 Medium"
                  ],
                  "p" : 0.0325248132736696
               },
               {
                  "groups" : [
                     "2 Medium",
                     "3 High"
                  ],
                  "p" : 0.114557102318147
               },
               {
                  "groups" : [
                     "1 Low",
                     "3 High"
                  ],
                  "p" : 0.0023267944377645
               }
            ]
         },
         "showBoxplotOriginalData" : true,
         "jitter" : true,
         "colorScheme" : "Set1"
      }

      // 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-statistics8-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-statistics8-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="tension",
colorScheme="Set1",
graphOrientation="vertical",
graphType="Boxplot",
groupingFactors=list("tension"),
jitter=TRUE,
showBoxplotOriginalData=TRUE,
showLegend=FALSE,
showStatInference=TRUE,
smpTextRotate=0,
smpTitle="tension",
smpTitleFontStyle="bold",
statInference=list(annotate="stars", comparisons=list(list(groups=list("1 Low", "2 Medium"), p=0.0325248132736696), list(groups=list("2 Medium", "3 High"), p=0.114557102318147), list(groups=list("1 Low", "3 High"), p=0.0023267944377645)), correction=list(method="holm")),
title="Wool breaks by tension (Welch t-test, Holm-adjusted)",
xAxis=list("breaks"),
xAxisTitle="breaks"
)
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 = "statistics8",
    data = {
      "y": {
        "vars": ["breaks"],
        "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", "Obs31", "Obs32", "Obs33", "Obs34", "Obs35", "Obs36", "Obs37", "Obs38", "Obs39", "Obs40", "Obs41", "Obs42", "Obs43", "Obs44", "Obs45", "Obs46", "Obs47", "Obs48", "Obs49", "Obs50", "Obs51", "Obs52", "Obs53", "Obs54"],
        "data": [
          [26, 30, 54, 25, 70, 52, 51, 26, 67, 27, 14, 29, 19, 29, 31, 41, 20, 44, 18, 21, 29, 17, 12, 18, 35, 30, 36, 42, 26, 19, 16, 39, 28, 21, 39, 29, 36, 21, 24, 18, 10, 43, 28, 15, 26, 20, 21, 24, 17, 13, 15, 15, 16, 28]
        ]
      },
      "x": {
        "tension": ["1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High"]
      }
    },
    config = {
      "graphType": "Boxplot",
      "graphOrientation": "vertical",
      "groupingFactors": ["tension"],
      "xAxis": ["breaks"],
      "xAxisTitle": "breaks",
      "smpTitle": "tension",
      "smpTitleFontStyle": "bold",
      "axisTitleFontStyle": "bold",
      "axisAlgorithm": "rPretty",
      "smpTextRotate": 0,
      "showLegend": False,
      "colorBy": "tension",
      "title": "Wool breaks by tension (Welch t-test, Holm-adjusted)",
      "showStatInference": True,
      "statInference": {
        "correction": {
          "method": "holm"
        },
        "annotate": "stars",
        "comparisons": [
          {
            "groups": ["1 Low", "2 Medium"],
            "p": 0.0325248132736696
          },
          {
            "groups": ["2 Medium", "3 High"],
            "p": 0.114557102318147
          },
          {
            "groups": ["1 Low", "3 High"],
            "p": 0.0023267944377645
          }
        ]
      },
      "showBoxplotOriginalData": True,
      "jitter": True,
      "colorScheme": "Set1"
    },
    width = 600,
    height = 600
  )

  # Display the chart in its own Web page
  show_in_browser(chart)
Run this notebook: Open in Binder
from canvasxpress.canvas import CanvasXpress
from canvasxpress.plot import graph

graph(
  CanvasXpress(
    render_to = "statistics8",
    data = {
      "y": {
        "vars": ["breaks"],
        "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", "Obs31", "Obs32", "Obs33", "Obs34", "Obs35", "Obs36", "Obs37", "Obs38", "Obs39", "Obs40", "Obs41", "Obs42", "Obs43", "Obs44", "Obs45", "Obs46", "Obs47", "Obs48", "Obs49", "Obs50", "Obs51", "Obs52", "Obs53", "Obs54"],
        "data": [
          [26, 30, 54, 25, 70, 52, 51, 26, 67, 27, 14, 29, 19, 29, 31, 41, 20, 44, 18, 21, 29, 17, 12, 18, 35, 30, 36, 42, 26, 19, 16, 39, 28, 21, 39, 29, 36, 21, 24, 18, 10, 43, 28, 15, 26, 20, 21, 24, 17, 13, 15, 15, 16, 28]
        ]
      },
      "x": {
        "tension": ["1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High"]
      }
    },
    config = {
      "graphType": "Boxplot",
      "graphOrientation": "vertical",
      "groupingFactors": ["tension"],
      "xAxis": ["breaks"],
      "xAxisTitle": "breaks",
      "smpTitle": "tension",
      "smpTitleFontStyle": "bold",
      "axisTitleFontStyle": "bold",
      "axisAlgorithm": "rPretty",
      "smpTextRotate": 0,
      "showLegend": False,
      "colorBy": "tension",
      "title": "Wool breaks by tension (Welch t-test, Holm-adjusted)",
      "showStatInference": True,
      "statInference": {
        "correction": {
          "method": "holm"
        },
        "annotate": "stars",
        "comparisons": [
          {
            "groups": ["1 Low", "2 Medium"],
            "p": 0.0325248132736696
          },
          {
            "groups": ["2 Medium", "3 High"],
            "p": 0.114557102318147
          },
          {
            "groups": ["1 Low", "3 High"],
            "p": 0.0023267944377645
          }
        ]
      },
      "showBoxplotOriginalData": True,
      "jitter": True,
      "colorScheme": "Set1"
    },
    width = 600,
    height = 600
  )
)
using CanvasXpress

canvasxpress(Dict(
  "y" => Dict(
    "vars" => ["breaks"],
    "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", "Obs31", "Obs32", "Obs33", "Obs34", "Obs35", "Obs36", "Obs37", "Obs38", "Obs39", "Obs40", "Obs41", "Obs42", "Obs43", "Obs44", "Obs45", "Obs46", "Obs47", "Obs48", "Obs49", "Obs50", "Obs51", "Obs52", "Obs53", "Obs54"],
    "data" => [
      [26, 30, 54, 25, 70, 52, 51, 26, 67, 27, 14, 29, 19, 29, 31, 41, 20, 44, 18, 21, 29, 17, 12, 18, 35, 30, 36, 42, 26, 19, 16, 39, 28, 21, 39, 29, 36, 21, 24, 18, 10, 43, 28, 15, 26, 20, 21, 24, 17, 13, 15, 15, 16, 28]
    ]
  ),
  "x" => Dict(
    "tension" => ["1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "1 Low", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "2 Medium", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High", "3 High"]
  )
);
  graphType = "Boxplot",
  graphOrientation = "vertical",
  groupingFactors = ["tension"],
  xAxis = ["breaks"],
  xAxisTitle = "breaks",
  smpTitle = "tension",
  smpTitleFontStyle = "bold",
  axisTitleFontStyle = "bold",
  axisAlgorithm = "rPretty",
  smpTextRotate = 0,
  showLegend = false,
  colorBy = "tension",
  title = "Wool breaks by tension (Welch t-test, Holm-adjusted)",
  showStatInference = true,
  statInference = Dict(
    "correction" => Dict(
      "method" => "holm"
    ),
    "annotate" => "stars",
    "comparisons" => [
      Dict(
        "groups" => ["1 Low", "2 Medium"],
        "p" => 0.0325248132736696
      ),
      Dict(
        "groups" => ["2 Medium", "3 High"],
        "p" => 0.114557102318147
      ),
      Dict(
        "groups" => ["1 Low", "3 High"],
        "p" => 0.0023267944377645
      )
    ]
  ),
  showBoxplotOriginalData = true,
  jitter = true,
  colorScheme = "Set1"
)
⇧