Segregated Connected Raincloud

Violin plots offer a compelling visualization combining box plots and kernel density estimations. They showcase data distribution, including median, quartiles, and the probability density of the data at different values. This detailed view helps compare distributions across multiple groups effectively. Unlike box plots which only show summary statistics, violin plots provide a richer understanding of the data shape and spread, revealing skewness and the presence of outliers more clearly. They are particularly useful for identifying differences and similarities between various datasets. This enhanced visualization improves data interpretation and communication.


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 = {
        "backgroundType": "panel",
        "boxplotWidthRatioIfViolin": 0.15,
        "colorBy": "Cohort",
        "colorScheme": "GGPlot",
        "connectBy": "Subject",
        "connectByPointColor": true,
        "connectByWidth": 1,
        "graphOrientation": "vertical",
        "graphType": "Boxplot",
        "groupingFactors": [
          "Condition"
        ],
        "guidesColor": "white",
        "guidesShow": true,
        "jitter": true,
        "jitterFactor": 0.6,
        "layoutTopology": "1X3",
        "panelBackgroundColor": "#EDEDED",
        "segregateSamplesBy": [
          "Cohort"
        ],
        "showBoxplotIfViolin": true,
        "showBoxplotOriginalData": true,
        "showBoxplotOriginalDataColor": true,
        "showLegend": false,
        "showViolinBoxplot": true,
        "smpTextRotate": 90,
        "smpTextScaleFontFactor": 0.83,
        "smpTitle": "Condition",
        "stringSampleFactors": [
          "Condition",
          "Cohort"
        ],
        "title": "Paired Raincloud by Cohort",
        "violinScale": "width",
        "violinSide": {
          "Baseline": "lt",
          "Followup": "rb"
        },
        "violinTransparency": 0.5,
        "xAxis": [
          "Value"
        ],
        "xAxisTitle": "Value"
      }

      // 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 = {
         "x" : {
            "Condition" : [
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Baseline",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup",
               "Followup"
            ],
            "Cohort" : [
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort A",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort B",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C",
               "Cohort C"
            ],
            "Subject" : [
               "A-S00",
               "A-S01",
               "A-S02",
               "A-S03",
               "A-S04",
               "A-S05",
               "A-S06",
               "A-S07",
               "A-S08",
               "A-S09",
               "A-S10",
               "A-S11",
               "A-S12",
               "A-S13",
               "A-S00",
               "A-S01",
               "A-S02",
               "A-S03",
               "A-S04",
               "A-S05",
               "A-S06",
               "A-S07",
               "A-S08",
               "A-S09",
               "A-S10",
               "A-S11",
               "A-S12",
               "A-S13",
               "B-S00",
               "B-S01",
               "B-S02",
               "B-S03",
               "B-S04",
               "B-S05",
               "B-S06",
               "B-S07",
               "B-S08",
               "B-S09",
               "B-S10",
               "B-S11",
               "B-S12",
               "B-S13",
               "B-S00",
               "B-S01",
               "B-S02",
               "B-S03",
               "B-S04",
               "B-S05",
               "B-S06",
               "B-S07",
               "B-S08",
               "B-S09",
               "B-S10",
               "B-S11",
               "B-S12",
               "B-S13",
               "C-S00",
               "C-S01",
               "C-S02",
               "C-S03",
               "C-S04",
               "C-S05",
               "C-S06",
               "C-S07",
               "C-S08",
               "C-S09",
               "C-S10",
               "C-S11",
               "C-S12",
               "C-S13",
               "C-S00",
               "C-S01",
               "C-S02",
               "C-S03",
               "C-S04",
               "C-S05",
               "C-S06",
               "C-S07",
               "C-S08",
               "C-S09",
               "C-S10",
               "C-S11",
               "C-S12",
               "C-S13"
            ]
         },
         "y" : {
            "vars" : [
               "Value"
            ],
            "smps" : [
               "B-A-S00",
               "B-A-S01",
               "B-A-S02",
               "B-A-S03",
               "B-A-S04",
               "B-A-S05",
               "B-A-S06",
               "B-A-S07",
               "B-A-S08",
               "B-A-S09",
               "B-A-S10",
               "B-A-S11",
               "B-A-S12",
               "B-A-S13",
               "F-A-S00",
               "F-A-S01",
               "F-A-S02",
               "F-A-S03",
               "F-A-S04",
               "F-A-S05",
               "F-A-S06",
               "F-A-S07",
               "F-A-S08",
               "F-A-S09",
               "F-A-S10",
               "F-A-S11",
               "F-A-S12",
               "F-A-S13",
               "B-B-S00",
               "B-B-S01",
               "B-B-S02",
               "B-B-S03",
               "B-B-S04",
               "B-B-S05",
               "B-B-S06",
               "B-B-S07",
               "B-B-S08",
               "B-B-S09",
               "B-B-S10",
               "B-B-S11",
               "B-B-S12",
               "B-B-S13",
               "F-B-S00",
               "F-B-S01",
               "F-B-S02",
               "F-B-S03",
               "F-B-S04",
               "F-B-S05",
               "F-B-S06",
               "F-B-S07",
               "F-B-S08",
               "F-B-S09",
               "F-B-S10",
               "F-B-S11",
               "F-B-S12",
               "F-B-S13",
               "B-C-S00",
               "B-C-S01",
               "B-C-S02",
               "B-C-S03",
               "B-C-S04",
               "B-C-S05",
               "B-C-S06",
               "B-C-S07",
               "B-C-S08",
               "B-C-S09",
               "B-C-S10",
               "B-C-S11",
               "B-C-S12",
               "B-C-S13",
               "F-C-S00",
               "F-C-S01",
               "F-C-S02",
               "F-C-S03",
               "F-C-S04",
               "F-C-S05",
               "F-C-S06",
               "F-C-S07",
               "F-C-S08",
               "F-C-S09",
               "F-C-S10",
               "F-C-S11",
               "F-C-S12",
               "F-C-S13"
            ],
            "data" : [
               [
                  5.1,
                  4.91,
                  5.17,
                  4.92,
                  5.27,
                  5.41,
                  5.26,
                  4.83,
                  4.88,
                  4.81,
                  4.73,
                  5.09,
                  4.96,
                  4.72,
                  5.81,
                  5.74,
                  6.23,
                  5.83,
                  6.18,
                  6.03,
                  6.09,
                  5.57,
                  5.86,
                  5.88,
                  5.4,
                  5.92,
                  6.01,
                  5.21,
                  5.18,
                  4.29,
                  4.82,
                  4.47,
                  4.5,
                  4.15,
                  4.44,
                  4.89,
                  4.46,
                  4.91,
                  4.92,
                  4.95,
                  4.66,
                  4.84,
                  6.34,
                  5.62,
                  6.24,
                  6.25,
                  5.73,
                  5.73,
                  5.8,
                  6.7,
                  5.8,
                  6.59,
                  6.1,
                  6.26,
                  5.81,
                  6.17,
                  4.73,
                  4.63,
                  5.43,
                  5.62,
                  5.59,
                  5.26,
                  5.61,
                  5.87,
                  5.81,
                  5.41,
                  6.0,
                  4.73,
                  5.28,
                  5.12,
                  5.11,
                  5.35,
                  5.56,
                  6.75,
                  6.5,
                  5.77,
                  6.13,
                  6.55,
                  5.85,
                  6.01,
                  6.14,
                  4.96,
                  5.49,
                  5.5
               ]
            ]
         }
      }

      // Create the configuration for the graph
      var config = {
        "backgroundType": "panel",
        "boxplotWidthRatioIfViolin": 0.15,
        "colorBy": "Cohort",
        "colorScheme": "GGPlot",
        "connectBy": "Subject",
        "connectByPointColor": true,
        "connectByWidth": 1,
        "graphOrientation": "vertical",
        "graphType": "Boxplot",
        "groupingFactors": [
          "Condition"
        ],
        "guidesColor": "white",
        "guidesShow": true,
        "jitter": true,
        "jitterFactor": 0.6,
        "layoutTopology": "1X3",
        "panelBackgroundColor": "#EDEDED",
        "segregateSamplesBy": [
          "Cohort"
        ],
        "showBoxplotIfViolin": true,
        "showBoxplotOriginalData": true,
        "showBoxplotOriginalDataColor": true,
        "showLegend": false,
        "showViolinBoxplot": true,
        "smpTextRotate": 90,
        "smpTextScaleFontFactor": 0.83,
        "smpTitle": "Condition",
        "stringSampleFactors": [
          "Condition",
          "Cohort"
        ],
        "title": "Paired Raincloud by Cohort",
        "violinScale": "width",
        "violinSide": {
          "Baseline": "lt",
          "Followup": "rb"
        },
        "violinTransparency": 0.5,
        "xAxis": [
          "Value"
        ],
        "xAxisTitle": "Value"
      }

      // 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-violin29-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-violin29-smp.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
data=y,
smpAnnot=x,
backgroundType="panel",
boxplotWidthRatioIfViolin=0.15,
colorBy="Cohort",
colorScheme="GGPlot",
connectBy="Subject",
connectByPointColor=TRUE,
connectByWidth=1,
graphOrientation="vertical",
graphType="Boxplot",
groupingFactors=list("Condition"),
guidesColor="white",
guidesShow=TRUE,
jitter=TRUE,
jitterFactor=0.6,
layoutTopology="1X3",
panelBackgroundColor="#EDEDED",
segregateSamplesBy=list("Cohort"),
showBoxplotIfViolin=TRUE,
showBoxplotOriginalData=TRUE,
showBoxplotOriginalDataColor=TRUE,
showLegend=FALSE,
showViolinBoxplot=TRUE,
smpTextRotate=90,
smpTextScaleFontFactor=0.83,
smpTitle="Condition",
stringSampleFactors=list("Condition", "Cohort"),
title="Paired Raincloud by Cohort",
violinScale="width",
violinSide=list(Baseline="lt", Followup="rb"),
violinTransparency=0.5,
xAxis=list("Value"),
xAxisTitle="Value"
)