Quick Tips: Short vs. Fat

Line graphs are visual representations of data points connected by line segments. They effectively showcase trends and changes over time or across different categories. Ideal for displaying continuous data, line graphs highlight patterns and correlations, making complex information easily digestible. Creating effective line graphs involves careful consideration of axis labels, scales, and legends. Clear and concise titles are essential for quick understanding. Multiple datasets can be compared on a single graph, enhancing visual analysis and facilitating insightful conclusions.


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 = [
        [ "Id", 1, 2, 3, 4, 5],
        [ 118, 30, 33, 30, 32, 30],
        [ 484, 58, 69, 51, 62, 49],
        [ 664, 87, 111, 75, 112, 81],
        [ 1004, 115, 156, 108, 167, 125],
        [ 1231, 120, 172, 115, 179, 142],
        [ 1372, 142, 203, 139, 209, 174],
        [ 1582, 145, 203, 140, 214, 177 ]
      ];

      // Create the configuration for the graph
      var config = {
         "backgroundType" : "panel",
         "blockContrast" : true,
         "evenColor" : "rgb(226,236,248)",
         "graphOrientation" : "vertical",
         "graphType" : "Line",
         "legendInside" : true,
         "legendKeyBackgroundBorderColor" : "rgba(255,255,255,0)",
         "legendKeyBackgroundColor" : "rgba(255,255,255,0)",
         "legendPosition" : "topLeft",
         "panelBackgroundColor" : "rgb(226,236,248)",
         "smpTextRotate" : 90,
         "smpTitle" : "Days Old",
         "theme" : "GGPlot",
         "title" : "Growth of Orange Trees",
         "xAxisTitle" : "Circumference (mm)",
         "xAxis" : [1,2,3,4,5]
      }

      // 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" : {
            "data" : [
              [30,58,87,115,120,142,145],
              [33,69,111,156,172,203,203],
              [30,51,75,108,115,139,140],
              [32,62,112,167,179,209,214],
              [30,49,81,125,142,174,177]
            ],
            "smps" : [118,484,664,1004,1231,1372,1582],
            "vars" : [1,2,3,4,5]
         }
      }

      // Create the configuration for the graph
      var config = {
         "backgroundType" : "panel",
         "blockContrast" : true,
         "evenColor" : "rgb(226,236,248)",
         "graphOrientation" : "vertical",
         "graphType" : "Line",
         "legendInside" : true,
         "legendKeyBackgroundBorderColor" : "rgba(255,255,255,0)",
         "legendKeyBackgroundColor" : "rgba(255,255,255,0)",
         "legendPosition" : "topLeft",
         "panelBackgroundColor" : "rgb(226,236,248)",
         "smpTextRotate" : 90,
         "smpTitle" : "Days Old",
         "theme" : "GGPlot",
         "title" : "Growth of Orange Trees",
         "xAxisTitle" : "Circumference (mm)",
         "xAxis" : [1,2,3,4,5]
      }

      // 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-oranges-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
  data=y,
  backgroundType="panel",
  blockContrast=TRUE,
  evenColor="rgb(226,236,248)",
  graphOrientation="vertical",
  graphType="Line",
  legendInside=TRUE,
  legendKeyBackgroundBorderColor="rgba(255,255,255,0)",
  legendKeyBackgroundColor="rgba(255,255,255,0)",
  legendPosition="topLeft",
  panelBackgroundColor="rgb(226,236,248)",
  smpTextRotate=90,
  smpTitle="Days Old",
  theme="GGPlot",
  title="Growth of Orange Trees",
  xAxis=list(1, 2, 3, 4, 5),
  xAxisTitle="Circumference (mm)"
)