Three dots per row on a connecting range

Dumbbell graphs display the relationship between two data points for multiple categories by connecting them with a line. It effectively shows the difference or change between these two values for each item, allowing for easy comparison of magnitudes and variations across the dataset. This visualization is useful for highlighting shifts or disparities.


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" : "Dumbbell",
         "dumbbellType" : "connected",
         "theme" : "classic",
         "colorScheme" : "User",
         "colors" : [
            "#56B4E9",
            "#555555",
            "#E69F00"
         ],
         "title" : "Reef fish tolerate a narrower warm range than a cold one",
         "subtitle" : "Thermal limits and optimum of twelve reef fish species, in °C",
         "xAxisTitle" : "Temperature (°C)",
         "sortDir" : "ascending",
         "sortBy" : "Maximum (CTmax)",
         "xAxis" : [
            "Minimum (CTmin)",
            "Optimum",
            "Maximum (CTmax)"
         ],
         "legendPosition" : "top",
         "dataPointSizeScaleFactor" : 2.2,
         "smpTitleFontStyle" : "bold",
         "citation" : "Source: synthetic data for illustration"
      }

      // 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" : [
               "Minimum (CTmin)",
               "Optimum",
               "Maximum (CTmax)"
            ],
            "smps" : [
               "Clownfish",
               "Blue tang",
               "Parrotfish",
               "Moray eel",
               "Lionfish",
               "Damselfish",
               "Butterflyfish",
               "Grouper",
               "Wrasse",
               "Goby",
               "Seahorse",
               "Pufferfish"
            ],
            "data" : [
               [
                  19.5,
                  18.2,
                  17,
                  15.8,
                  14.9,
                  16.4,
                  18.8,
                  14.2,
                  13.5,
                  12.1,
                  15,
                  16.2
               ],
               [
                  27.5,
                  26,
                  25.1,
                  24,
                  23.2,
                  25.5,
                  26.8,
                  22.4,
                  21.5,
                  20,
                  22.8,
                  24.4
               ],
               [
                  34,
                  33.1,
                  33.4,
                  32.2,
                  31,
                  32.8,
                  33.6,
                  31.2,
                  30,
                  29.4,
                  29.8,
                  32
               ]
            ]
         }
      }

      // Create the configuration for the graph
      var config = {
         "graphType" : "Dumbbell",
         "dumbbellType" : "connected",
         "theme" : "classic",
         "colorScheme" : "User",
         "colors" : [
            "#56B4E9",
            "#555555",
            "#E69F00"
         ],
         "title" : "Reef fish tolerate a narrower warm range than a cold one",
         "subtitle" : "Thermal limits and optimum of twelve reef fish species, in °C",
         "xAxisTitle" : "Temperature (°C)",
         "sortDir" : "ascending",
         "sortBy" : "Maximum (CTmax)",
         "xAxis" : [
            "Minimum (CTmin)",
            "Optimum",
            "Maximum (CTmax)"
         ],
         "legendPosition" : "top",
         "dataPointSizeScaleFactor" : 2.2,
         "smpTitleFontStyle" : "bold",
         "citation" : "Source: synthetic data for illustration"
      }

      // 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-dumbbell10-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
data=y,
citation="Source: synthetic data for illustration",
colorScheme="User",
colors=list("#56B4E9", "#555555", "#E69F00"),
dataPointSizeScaleFactor=2.2,
dumbbellType="connected",
graphType="Dumbbell",
legendPosition="top",
smpTitleFontStyle="bold",
sortBy="Maximum (CTmax)",
sortDir="ascending",
subtitle="Thermal limits and optimum of twelve reef fish species, in °C",
theme="classic",
title="Reef fish tolerate a narrower warm range than a cold one",
xAxis=list("Minimum (CTmin)", "Optimum", "Maximum (CTmax)"),
xAxisTitle="Temperature (°C)"
)
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 = "dumbbell10",
    data = {
      "y": {
        "vars": ["Minimum (CTmin)", "Optimum", "Maximum (CTmax)"],
        "smps": ["Clownfish", "Blue tang", "Parrotfish", "Moray eel", "Lionfish", "Damselfish", "Butterflyfish", "Grouper", "Wrasse", "Goby", "Seahorse", "Pufferfish"],
        "data": [
          [19.5, 18.2, 17, 15.8, 14.9, 16.4, 18.8, 14.2, 13.5, 12.1, 15, 16.2],
          [27.5, 26, 25.1, 24, 23.2, 25.5, 26.8, 22.4, 21.5, 20, 22.8, 24.4],
          [34, 33.1, 33.4, 32.2, 31, 32.8, 33.6, 31.2, 30, 29.4, 29.8, 32]
        ]
      }
    },
    config = {
      "graphType": "Dumbbell",
      "dumbbellType": "connected",
      "theme": "classic",
      "colorScheme": "User",
      "colors": ["#56B4E9", "#555555", "#E69F00"],
      "title": "Reef fish tolerate a narrower warm range than a cold one",
      "subtitle": "Thermal limits and optimum of twelve reef fish species, in °C",
      "xAxisTitle": "Temperature (°C)",
      "sortDir": "ascending",
      "sortBy": "Maximum (CTmax)",
      "xAxis": ["Minimum (CTmin)", "Optimum", "Maximum (CTmax)"],
      "legendPosition": "top",
      "dataPointSizeScaleFactor": 2.2,
      "smpTitleFontStyle": "bold",
      "citation": "Source: synthetic data for illustration"
    },
    width = 760,
    height = 520
  )

  # 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 = "dumbbell10",
    data = {
      "y": {
        "vars": ["Minimum (CTmin)", "Optimum", "Maximum (CTmax)"],
        "smps": ["Clownfish", "Blue tang", "Parrotfish", "Moray eel", "Lionfish", "Damselfish", "Butterflyfish", "Grouper", "Wrasse", "Goby", "Seahorse", "Pufferfish"],
        "data": [
          [19.5, 18.2, 17, 15.8, 14.9, 16.4, 18.8, 14.2, 13.5, 12.1, 15, 16.2],
          [27.5, 26, 25.1, 24, 23.2, 25.5, 26.8, 22.4, 21.5, 20, 22.8, 24.4],
          [34, 33.1, 33.4, 32.2, 31, 32.8, 33.6, 31.2, 30, 29.4, 29.8, 32]
        ]
      }
    },
    config = {
      "graphType": "Dumbbell",
      "dumbbellType": "connected",
      "theme": "classic",
      "colorScheme": "User",
      "colors": ["#56B4E9", "#555555", "#E69F00"],
      "title": "Reef fish tolerate a narrower warm range than a cold one",
      "subtitle": "Thermal limits and optimum of twelve reef fish species, in °C",
      "xAxisTitle": "Temperature (°C)",
      "sortDir": "ascending",
      "sortBy": "Maximum (CTmax)",
      "xAxis": ["Minimum (CTmin)", "Optimum", "Maximum (CTmax)"],
      "legendPosition": "top",
      "dataPointSizeScaleFactor": 2.2,
      "smpTitleFontStyle": "bold",
      "citation": "Source: synthetic data for illustration"
    },
    width = 760,
    height = 520
  )
)
using CanvasXpress

canvasxpress(Dict(
  "y" => Dict(
    "vars" => ["Minimum (CTmin)", "Optimum", "Maximum (CTmax)"],
    "smps" => ["Clownfish", "Blue tang", "Parrotfish", "Moray eel", "Lionfish", "Damselfish", "Butterflyfish", "Grouper", "Wrasse", "Goby", "Seahorse", "Pufferfish"],
    "data" => [
      [19.5, 18.2, 17, 15.8, 14.9, 16.4, 18.8, 14.2, 13.5, 12.1, 15, 16.2],
      [27.5, 26, 25.1, 24, 23.2, 25.5, 26.8, 22.4, 21.5, 20, 22.8, 24.4],
      [34, 33.1, 33.4, 32.2, 31, 32.8, 33.6, 31.2, 30, 29.4, 29.8, 32]
    ]
  )
);
  graphType = "Dumbbell",
  dumbbellType = "connected",
  theme = "classic",
  colorScheme = "User",
  colors = ["#56B4E9", "#555555", "#E69F00"],
  title = "Reef fish tolerate a narrower warm range than a cold one",
  subtitle = "Thermal limits and optimum of twelve reef fish species, in °C",
  xAxisTitle = "Temperature (°C)",
  sortDir = "ascending",
  sortBy = "Maximum (CTmax)",
  xAxis = ["Minimum (CTmin)", "Optimum", "Maximum (CTmax)"],
  legendPosition = "top",
  dataPointSizeScaleFactor = 2.2,
  smpTitleFontStyle = "bold",
  citation = "Source: synthetic data for illustration"
)
⇧