Strip Plot


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" : "StripPlot",
         "graphOrientation" : "vertical",
         "groupingFactors" : [
            "Group"
         ],
         "colorBy" : "Group",
         "title" : "Strip Plot",
         "yAxisTitle" : "Score"
      }

      // 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" : [
               "Score"
            ],
            "smps" : [
               "s1",
               "s2",
               "s3",
               "s4",
               "s5",
               "s6",
               "s7",
               "s8",
               "s9",
               "s10",
               "s11",
               "s12",
               "s13",
               "s14",
               "s15",
               "s16",
               "s17",
               "s18"
            ],
            "data" : [
               [
                  82,
                  85,
                  79,
                  88,
                  91,
                  84,
                  77,
                  90,
                  86,
                  61,
                  65,
                  58,
                  70,
                  63,
                  67,
                  55,
                  72,
                  60
               ]
            ]
         },
         "x" : {
            "Group" : [
               "Control",
               "Control",
               "Control",
               "Control",
               "Control",
               "Control",
               "Control",
               "Control",
               "Control",
               "Low Dose",
               "Low Dose",
               "Low Dose",
               "Low Dose",
               "Low Dose",
               "Low Dose",
               "Low Dose",
               "Low Dose",
               "Low Dose"
            ]
         }
      }

      // Create the configuration for the graph
      var config = {
         "graphType" : "StripPlot",
         "graphOrientation" : "vertical",
         "groupingFactors" : [
            "Group"
         ],
         "colorBy" : "Group",
         "title" : "Strip Plot",
         "yAxisTitle" : "Score"
      }

      // 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-stripplot1-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-stripplot1-smp.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
data=y,
smpAnnot=x,
colorBy="Group",
graphOrientation="vertical",
graphType="StripPlot",
groupingFactors=list("Group"),
title="Strip Plot",
yAxisTitle="Score"
)
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 = "stripplot1",
    data = {
      "y": {
        "vars": ["Score"],
        "smps": ["s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", "s16", "s17", "s18"],
        "data": [
          [82, 85, 79, 88, 91, 84, 77, 90, 86, 61, 65, 58, 70, 63, 67, 55, 72, 60]
        ]
      },
      "x": {
        "Group": ["Control", "Control", "Control", "Control", "Control", "Control", "Control", "Control", "Control", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose"]
      }
    },
    config = {
      "graphType": "StripPlot",
      "graphOrientation": "vertical",
      "groupingFactors": ["Group"],
      "colorBy": "Group",
      "title": "Strip Plot",
      "yAxisTitle": "Score"
    },
    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 = "stripplot1",
    data = {
      "y": {
        "vars": ["Score"],
        "smps": ["s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", "s16", "s17", "s18"],
        "data": [
          [82, 85, 79, 88, 91, 84, 77, 90, 86, 61, 65, 58, 70, 63, 67, 55, 72, 60]
        ]
      },
      "x": {
        "Group": ["Control", "Control", "Control", "Control", "Control", "Control", "Control", "Control", "Control", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose"]
      }
    },
    config = {
      "graphType": "StripPlot",
      "graphOrientation": "vertical",
      "groupingFactors": ["Group"],
      "colorBy": "Group",
      "title": "Strip Plot",
      "yAxisTitle": "Score"
    },
    width = 600,
    height = 600
  )
)
using CanvasXpress

canvasxpress(Dict(
  "y" => Dict(
    "vars" => ["Score"],
    "smps" => ["s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", "s16", "s17", "s18"],
    "data" => [
      [82, 85, 79, 88, 91, 84, 77, 90, 86, 61, 65, 58, 70, 63, 67, 55, 72, 60]
    ]
  ),
  "x" => Dict(
    "Group" => ["Control", "Control", "Control", "Control", "Control", "Control", "Control", "Control", "Control", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose", "Low Dose"]
  )
);
  graphType = "StripPlot",
  graphOrientation = "vertical",
  groupingFactors = ["Group"],
  colorBy = "Group",
  title = "Strip Plot",
  yAxisTitle = "Score"
)
⇧