Forecast on a Date Axis

Scatter2D graphs are a fundamental visualization tool used to display the relationship between two numerical variables. Each data point is represented as a dot on a two-dimensional plane, where the x-coordinate and y-coordinate correspond to the values of the two variables. This allows for quick identification of trends, clusters, and outliers in the data. Applications range from scientific data analysis to business intelligence, making them highly versatile. Creating effective Scatter2D graphs involves careful consideration of axis scaling, labeling, and color-coding. Highlighting specific data points or regions can improve understanding. Interactive Scatter2D plots further enhance exploration, allowing users to zoom, pan, and select individual data points for detailed examination. Choosing appropriate visualization tools greatly impacts the ability to draw meaningful insights from data.


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" : "Scatter2D",
         "scatterType" : "line",
         "xAxis" : [
            "Month"
         ],
         "yAxis" : [
            "Deaths"
         ],
         "xAxisTime" : true,
         "showForecast" : true,
         "forecastSeasonLength" : 12,
         "forecastHorizon" : 12,
         "forecastLevel" : 0.8,
         "forecastLineType" : "dashed",
         "title" : "US accidental deaths (USAccDeaths)",
         "subtitle" : "Holt-Winters on a date axis, 80% interval",
         "fitLineColor" : "#0000AA"
      }

      // 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" : [
               "1973-01-01",
               "1973-02-01",
               "1973-03-01",
               "1973-04-01",
               "1973-05-01",
               "1973-06-01",
               "1973-07-01",
               "1973-08-01",
               "1973-09-01",
               "1973-10-01",
               "1973-11-01",
               "1973-12-01",
               "1974-01-01",
               "1974-02-01",
               "1974-03-01",
               "1974-04-01",
               "1974-05-01",
               "1974-06-01",
               "1974-07-01",
               "1974-08-01",
               "1974-09-01",
               "1974-10-01",
               "1974-11-01",
               "1974-12-01",
               "1975-01-01",
               "1975-02-01",
               "1975-03-01",
               "1975-04-01",
               "1975-05-01",
               "1975-06-01",
               "1975-07-01",
               "1975-08-01",
               "1975-09-01",
               "1975-10-01",
               "1975-11-01",
               "1975-12-01",
               "1976-01-01",
               "1976-02-01",
               "1976-03-01",
               "1976-04-01",
               "1976-05-01",
               "1976-06-01",
               "1976-07-01",
               "1976-08-01",
               "1976-09-01",
               "1976-10-01",
               "1976-11-01",
               "1976-12-01",
               "1977-01-01",
               "1977-02-01",
               "1977-03-01",
               "1977-04-01",
               "1977-05-01",
               "1977-06-01",
               "1977-07-01",
               "1977-08-01",
               "1977-09-01",
               "1977-10-01",
               "1977-11-01",
               "1977-12-01",
               "1978-01-01",
               "1978-02-01",
               "1978-03-01",
               "1978-04-01",
               "1978-05-01",
               "1978-06-01",
               "1978-07-01",
               "1978-08-01",
               "1978-09-01",
               "1978-10-01",
               "1978-11-01",
               "1978-12-01"
            ],
            "smps" : [
               "Month",
               "Deaths"
            ],
            "data" : [
               [
                  "1973-01-01",
                  9007
               ],
               [
                  "1973-02-01",
                  8106
               ],
               [
                  "1973-03-01",
                  8928
               ],
               [
                  "1973-04-01",
                  9137
               ],
               [
                  "1973-05-01",
                  10017
               ],
               [
                  "1973-06-01",
                  10826
               ],
               [
                  "1973-07-01",
                  11317
               ],
               [
                  "1973-08-01",
                  10744
               ],
               [
                  "1973-09-01",
                  9713
               ],
               [
                  "1973-10-01",
                  9938
               ],
               [
                  "1973-11-01",
                  9161
               ],
               [
                  "1973-12-01",
                  8927
               ],
               [
                  "1974-01-01",
                  7750
               ],
               [
                  "1974-02-01",
                  6981
               ],
               [
                  "1974-03-01",
                  8038
               ],
               [
                  "1974-04-01",
                  8422
               ],
               [
                  "1974-05-01",
                  8714
               ],
               [
                  "1974-06-01",
                  9512
               ],
               [
                  "1974-07-01",
                  10120
               ],
               [
                  "1974-08-01",
                  9823
               ],
               [
                  "1974-09-01",
                  8743
               ],
               [
                  "1974-10-01",
                  9129
               ],
               [
                  "1974-11-01",
                  8710
               ],
               [
                  "1974-12-01",
                  8680
               ],
               [
                  "1975-01-01",
                  8162
               ],
               [
                  "1975-02-01",
                  7306
               ],
               [
                  "1975-03-01",
                  8124
               ],
               [
                  "1975-04-01",
                  7870
               ],
               [
                  "1975-05-01",
                  9387
               ],
               [
                  "1975-06-01",
                  9556
               ],
               [
                  "1975-07-01",
                  10093
               ],
               [
                  "1975-08-01",
                  9620
               ],
               [
                  "1975-09-01",
                  8285
               ],
               [
                  "1975-10-01",
                  8466
               ],
               [
                  "1975-11-01",
                  8160
               ],
               [
                  "1975-12-01",
                  8034
               ],
               [
                  "1976-01-01",
                  7717
               ],
               [
                  "1976-02-01",
                  7461
               ],
               [
                  "1976-03-01",
                  7767
               ],
               [
                  "1976-04-01",
                  7925
               ],
               [
                  "1976-05-01",
                  8623
               ],
               [
                  "1976-06-01",
                  8945
               ],
               [
                  "1976-07-01",
                  10078
               ],
               [
                  "1976-08-01",
                  9179
               ],
               [
                  "1976-09-01",
                  8037
               ],
               [
                  "1976-10-01",
                  8488
               ],
               [
                  "1976-11-01",
                  7874
               ],
               [
                  "1976-12-01",
                  8647
               ],
               [
                  "1977-01-01",
                  7792
               ],
               [
                  "1977-02-01",
                  6957
               ],
               [
                  "1977-03-01",
                  7726
               ],
               [
                  "1977-04-01",
                  8106
               ],
               [
                  "1977-05-01",
                  8890
               ],
               [
                  "1977-06-01",
                  9299
               ],
               [
                  "1977-07-01",
                  10625
               ],
               [
                  "1977-08-01",
                  9302
               ],
               [
                  "1977-09-01",
                  8314
               ],
               [
                  "1977-10-01",
                  8850
               ],
               [
                  "1977-11-01",
                  8265
               ],
               [
                  "1977-12-01",
                  8796
               ],
               [
                  "1978-01-01",
                  7836
               ],
               [
                  "1978-02-01",
                  6892
               ],
               [
                  "1978-03-01",
                  7791
               ],
               [
                  "1978-04-01",
                  8192
               ],
               [
                  "1978-05-01",
                  9115
               ],
               [
                  "1978-06-01",
                  9434
               ],
               [
                  "1978-07-01",
                  10484
               ],
               [
                  "1978-08-01",
                  9827
               ],
               [
                  "1978-09-01",
                  9110
               ],
               [
                  "1978-10-01",
                  9070
               ],
               [
                  "1978-11-01",
                  8633
               ],
               [
                  "1978-12-01",
                  9240
               ]
            ]
         }
      }

      // Create the configuration for the graph
      var config = {
         "graphType" : "Scatter2D",
         "scatterType" : "line",
         "xAxis" : [
            "Month"
         ],
         "yAxis" : [
            "Deaths"
         ],
         "xAxisTime" : true,
         "showForecast" : true,
         "forecastSeasonLength" : 12,
         "forecastHorizon" : 12,
         "forecastLevel" : 0.8,
         "forecastLineType" : "dashed",
         "title" : "US accidental deaths (USAccDeaths)",
         "subtitle" : "Holt-Winters on a date axis, 80% interval",
         "fitLineColor" : "#0000AA"
      }

      // 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-scatter2d23-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
data=y,
fitLineColor="#0000AA",
forecastHorizon=12,
forecastLevel=0.8,
forecastLineType="dashed",
forecastSeasonLength=12,
graphType="Scatter2D",
scatterType="line",
showForecast=TRUE,
subtitle="Holt-Winters on a date axis, 80% interval",
title="US accidental deaths (USAccDeaths)",
xAxis=list("Month"),
xAxisTime=TRUE,
yAxis=list("Deaths")
)
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 = "scatter2d23",
    data = {
      "y": {
        "vars": ["1973-01-01", "1973-02-01", "1973-03-01", "1973-04-01", "1973-05-01", "1973-06-01", "1973-07-01", "1973-08-01", "1973-09-01", "1973-10-01", "1973-11-01", "1973-12-01", "1974-01-01", "1974-02-01", "1974-03-01", "1974-04-01", "1974-05-01", "1974-06-01", "1974-07-01", "1974-08-01", "1974-09-01", "1974-10-01", "1974-11-01", "1974-12-01", "1975-01-01", "1975-02-01", "1975-03-01", "1975-04-01", "1975-05-01", "1975-06-01", "1975-07-01", "1975-08-01", "1975-09-01", "1975-10-01", "1975-11-01", "1975-12-01", "1976-01-01", "1976-02-01", "1976-03-01", "1976-04-01", "1976-05-01", "1976-06-01", "1976-07-01", "1976-08-01", "1976-09-01", "1976-10-01", "1976-11-01", "1976-12-01", "1977-01-01", "1977-02-01", "1977-03-01", "1977-04-01", "1977-05-01", "1977-06-01", "1977-07-01", "1977-08-01", "1977-09-01", "1977-10-01", "1977-11-01", "1977-12-01", "1978-01-01", "1978-02-01", "1978-03-01", "1978-04-01", "1978-05-01", "1978-06-01", "1978-07-01", "1978-08-01", "1978-09-01", "1978-10-01", "1978-11-01", "1978-12-01"],
        "smps": ["Month", "Deaths"],
        "data": [
          ["1973-01-01", 9007],
          ["1973-02-01", 8106],
          ["1973-03-01", 8928],
          ["1973-04-01", 9137],
          ["1973-05-01", 10017],
          ["1973-06-01", 10826],
          ["1973-07-01", 11317],
          ["1973-08-01", 10744],
          ["1973-09-01", 9713],
          ["1973-10-01", 9938],
          ["1973-11-01", 9161],
          ["1973-12-01", 8927],
          ["1974-01-01", 7750],
          ["1974-02-01", 6981],
          ["1974-03-01", 8038],
          ["1974-04-01", 8422],
          ["1974-05-01", 8714],
          ["1974-06-01", 9512],
          ["1974-07-01", 10120],
          ["1974-08-01", 9823],
          ["1974-09-01", 8743],
          ["1974-10-01", 9129],
          ["1974-11-01", 8710],
          ["1974-12-01", 8680],
          ["1975-01-01", 8162],
          ["1975-02-01", 7306],
          ["1975-03-01", 8124],
          ["1975-04-01", 7870],
          ["1975-05-01", 9387],
          ["1975-06-01", 9556],
          ["1975-07-01", 10093],
          ["1975-08-01", 9620],
          ["1975-09-01", 8285],
          ["1975-10-01", 8466],
          ["1975-11-01", 8160],
          ["1975-12-01", 8034],
          ["1976-01-01", 7717],
          ["1976-02-01", 7461],
          ["1976-03-01", 7767],
          ["1976-04-01", 7925],
          ["1976-05-01", 8623],
          ["1976-06-01", 8945],
          ["1976-07-01", 10078],
          ["1976-08-01", 9179],
          ["1976-09-01", 8037],
          ["1976-10-01", 8488],
          ["1976-11-01", 7874],
          ["1976-12-01", 8647],
          ["1977-01-01", 7792],
          ["1977-02-01", 6957],
          ["1977-03-01", 7726],
          ["1977-04-01", 8106],
          ["1977-05-01", 8890],
          ["1977-06-01", 9299],
          ["1977-07-01", 10625],
          ["1977-08-01", 9302],
          ["1977-09-01", 8314],
          ["1977-10-01", 8850],
          ["1977-11-01", 8265],
          ["1977-12-01", 8796],
          ["1978-01-01", 7836],
          ["1978-02-01", 6892],
          ["1978-03-01", 7791],
          ["1978-04-01", 8192],
          ["1978-05-01", 9115],
          ["1978-06-01", 9434],
          ["1978-07-01", 10484],
          ["1978-08-01", 9827],
          ["1978-09-01", 9110],
          ["1978-10-01", 9070],
          ["1978-11-01", 8633],
          ["1978-12-01", 9240]
        ]
      }
    },
    config = {
      "graphType": "Scatter2D",
      "scatterType": "line",
      "xAxis": ["Month"],
      "yAxis": ["Deaths"],
      "xAxisTime": True,
      "showForecast": True,
      "forecastSeasonLength": 12,
      "forecastHorizon": 12,
      "forecastLevel": 0.8,
      "forecastLineType": "dashed",
      "title": "US accidental deaths (USAccDeaths)",
      "subtitle": "Holt-Winters on a date axis, 80% interval",
      "fitLineColor": "#0000AA"
    },
    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 = "scatter2d23",
    data = {
      "y": {
        "vars": ["1973-01-01", "1973-02-01", "1973-03-01", "1973-04-01", "1973-05-01", "1973-06-01", "1973-07-01", "1973-08-01", "1973-09-01", "1973-10-01", "1973-11-01", "1973-12-01", "1974-01-01", "1974-02-01", "1974-03-01", "1974-04-01", "1974-05-01", "1974-06-01", "1974-07-01", "1974-08-01", "1974-09-01", "1974-10-01", "1974-11-01", "1974-12-01", "1975-01-01", "1975-02-01", "1975-03-01", "1975-04-01", "1975-05-01", "1975-06-01", "1975-07-01", "1975-08-01", "1975-09-01", "1975-10-01", "1975-11-01", "1975-12-01", "1976-01-01", "1976-02-01", "1976-03-01", "1976-04-01", "1976-05-01", "1976-06-01", "1976-07-01", "1976-08-01", "1976-09-01", "1976-10-01", "1976-11-01", "1976-12-01", "1977-01-01", "1977-02-01", "1977-03-01", "1977-04-01", "1977-05-01", "1977-06-01", "1977-07-01", "1977-08-01", "1977-09-01", "1977-10-01", "1977-11-01", "1977-12-01", "1978-01-01", "1978-02-01", "1978-03-01", "1978-04-01", "1978-05-01", "1978-06-01", "1978-07-01", "1978-08-01", "1978-09-01", "1978-10-01", "1978-11-01", "1978-12-01"],
        "smps": ["Month", "Deaths"],
        "data": [
          ["1973-01-01", 9007],
          ["1973-02-01", 8106],
          ["1973-03-01", 8928],
          ["1973-04-01", 9137],
          ["1973-05-01", 10017],
          ["1973-06-01", 10826],
          ["1973-07-01", 11317],
          ["1973-08-01", 10744],
          ["1973-09-01", 9713],
          ["1973-10-01", 9938],
          ["1973-11-01", 9161],
          ["1973-12-01", 8927],
          ["1974-01-01", 7750],
          ["1974-02-01", 6981],
          ["1974-03-01", 8038],
          ["1974-04-01", 8422],
          ["1974-05-01", 8714],
          ["1974-06-01", 9512],
          ["1974-07-01", 10120],
          ["1974-08-01", 9823],
          ["1974-09-01", 8743],
          ["1974-10-01", 9129],
          ["1974-11-01", 8710],
          ["1974-12-01", 8680],
          ["1975-01-01", 8162],
          ["1975-02-01", 7306],
          ["1975-03-01", 8124],
          ["1975-04-01", 7870],
          ["1975-05-01", 9387],
          ["1975-06-01", 9556],
          ["1975-07-01", 10093],
          ["1975-08-01", 9620],
          ["1975-09-01", 8285],
          ["1975-10-01", 8466],
          ["1975-11-01", 8160],
          ["1975-12-01", 8034],
          ["1976-01-01", 7717],
          ["1976-02-01", 7461],
          ["1976-03-01", 7767],
          ["1976-04-01", 7925],
          ["1976-05-01", 8623],
          ["1976-06-01", 8945],
          ["1976-07-01", 10078],
          ["1976-08-01", 9179],
          ["1976-09-01", 8037],
          ["1976-10-01", 8488],
          ["1976-11-01", 7874],
          ["1976-12-01", 8647],
          ["1977-01-01", 7792],
          ["1977-02-01", 6957],
          ["1977-03-01", 7726],
          ["1977-04-01", 8106],
          ["1977-05-01", 8890],
          ["1977-06-01", 9299],
          ["1977-07-01", 10625],
          ["1977-08-01", 9302],
          ["1977-09-01", 8314],
          ["1977-10-01", 8850],
          ["1977-11-01", 8265],
          ["1977-12-01", 8796],
          ["1978-01-01", 7836],
          ["1978-02-01", 6892],
          ["1978-03-01", 7791],
          ["1978-04-01", 8192],
          ["1978-05-01", 9115],
          ["1978-06-01", 9434],
          ["1978-07-01", 10484],
          ["1978-08-01", 9827],
          ["1978-09-01", 9110],
          ["1978-10-01", 9070],
          ["1978-11-01", 8633],
          ["1978-12-01", 9240]
        ]
      }
    },
    config = {
      "graphType": "Scatter2D",
      "scatterType": "line",
      "xAxis": ["Month"],
      "yAxis": ["Deaths"],
      "xAxisTime": True,
      "showForecast": True,
      "forecastSeasonLength": 12,
      "forecastHorizon": 12,
      "forecastLevel": 0.8,
      "forecastLineType": "dashed",
      "title": "US accidental deaths (USAccDeaths)",
      "subtitle": "Holt-Winters on a date axis, 80% interval",
      "fitLineColor": "#0000AA"
    },
    width = 600,
    height = 600
  )
)
using CanvasXpress

canvasxpress(Dict(
  "y" => Dict(
    "vars" => ["1973-01-01", "1973-02-01", "1973-03-01", "1973-04-01", "1973-05-01", "1973-06-01", "1973-07-01", "1973-08-01", "1973-09-01", "1973-10-01", "1973-11-01", "1973-12-01", "1974-01-01", "1974-02-01", "1974-03-01", "1974-04-01", "1974-05-01", "1974-06-01", "1974-07-01", "1974-08-01", "1974-09-01", "1974-10-01", "1974-11-01", "1974-12-01", "1975-01-01", "1975-02-01", "1975-03-01", "1975-04-01", "1975-05-01", "1975-06-01", "1975-07-01", "1975-08-01", "1975-09-01", "1975-10-01", "1975-11-01", "1975-12-01", "1976-01-01", "1976-02-01", "1976-03-01", "1976-04-01", "1976-05-01", "1976-06-01", "1976-07-01", "1976-08-01", "1976-09-01", "1976-10-01", "1976-11-01", "1976-12-01", "1977-01-01", "1977-02-01", "1977-03-01", "1977-04-01", "1977-05-01", "1977-06-01", "1977-07-01", "1977-08-01", "1977-09-01", "1977-10-01", "1977-11-01", "1977-12-01", "1978-01-01", "1978-02-01", "1978-03-01", "1978-04-01", "1978-05-01", "1978-06-01", "1978-07-01", "1978-08-01", "1978-09-01", "1978-10-01", "1978-11-01", "1978-12-01"],
    "smps" => ["Month", "Deaths"],
    "data" => [
      ["1973-01-01", 9007],
      ["1973-02-01", 8106],
      ["1973-03-01", 8928],
      ["1973-04-01", 9137],
      ["1973-05-01", 10017],
      ["1973-06-01", 10826],
      ["1973-07-01", 11317],
      ["1973-08-01", 10744],
      ["1973-09-01", 9713],
      ["1973-10-01", 9938],
      ["1973-11-01", 9161],
      ["1973-12-01", 8927],
      ["1974-01-01", 7750],
      ["1974-02-01", 6981],
      ["1974-03-01", 8038],
      ["1974-04-01", 8422],
      ["1974-05-01", 8714],
      ["1974-06-01", 9512],
      ["1974-07-01", 10120],
      ["1974-08-01", 9823],
      ["1974-09-01", 8743],
      ["1974-10-01", 9129],
      ["1974-11-01", 8710],
      ["1974-12-01", 8680],
      ["1975-01-01", 8162],
      ["1975-02-01", 7306],
      ["1975-03-01", 8124],
      ["1975-04-01", 7870],
      ["1975-05-01", 9387],
      ["1975-06-01", 9556],
      ["1975-07-01", 10093],
      ["1975-08-01", 9620],
      ["1975-09-01", 8285],
      ["1975-10-01", 8466],
      ["1975-11-01", 8160],
      ["1975-12-01", 8034],
      ["1976-01-01", 7717],
      ["1976-02-01", 7461],
      ["1976-03-01", 7767],
      ["1976-04-01", 7925],
      ["1976-05-01", 8623],
      ["1976-06-01", 8945],
      ["1976-07-01", 10078],
      ["1976-08-01", 9179],
      ["1976-09-01", 8037],
      ["1976-10-01", 8488],
      ["1976-11-01", 7874],
      ["1976-12-01", 8647],
      ["1977-01-01", 7792],
      ["1977-02-01", 6957],
      ["1977-03-01", 7726],
      ["1977-04-01", 8106],
      ["1977-05-01", 8890],
      ["1977-06-01", 9299],
      ["1977-07-01", 10625],
      ["1977-08-01", 9302],
      ["1977-09-01", 8314],
      ["1977-10-01", 8850],
      ["1977-11-01", 8265],
      ["1977-12-01", 8796],
      ["1978-01-01", 7836],
      ["1978-02-01", 6892],
      ["1978-03-01", 7791],
      ["1978-04-01", 8192],
      ["1978-05-01", 9115],
      ["1978-06-01", 9434],
      ["1978-07-01", 10484],
      ["1978-08-01", 9827],
      ["1978-09-01", 9110],
      ["1978-10-01", 9070],
      ["1978-11-01", 8633],
      ["1978-12-01", 9240]
    ]
  )
);
  graphType = "Scatter2D",
  scatterType = "line",
  xAxis = ["Month"],
  yAxis = ["Deaths"],
  xAxisTime = true,
  showForecast = true,
  forecastSeasonLength = 12,
  forecastHorizon = 12,
  forecastLevel = 0.8,
  forecastLineType = "dashed",
  title = "US accidental deaths (USAccDeaths)",
  subtitle = "Holt-Winters on a date axis, 80% interval",
  fitLineColor = "#0000AA"
)
⇧