Theme

Bar

This tutorial describes how to make bar graphs.

Basic Bar Graph

The simplest bar graph.

Graph Data

{
   "y" : {
     "vars" : ["Variable1"],
     "smps" : ["Sample1", "Sample2", "Sample3"],
     "data" : [[33, 44, 55]]
   }
}
                

Graph Configuration

{
   "title" : "Bar Graph Title",
   "theme" : "CanvasXpress",
   "graphOrientation" : "vertical",
   "graphType" : "Bar"
}
                

 
 

Some caption here.

Graph Configuration

{
   "treemapBy" : [
      "ISO3"
   ],
   "title" : "Country Population colored by Gross National Income",
   "graphOrientation" : "vertical",
   "smpLabelRotate" : 45,
   "xAxisMinorTicks" : false,
   "subtitle" : "2014 Census",
   "legendInside" : true,
   "decorations" : {
      "marker" : [
         {
            "sample" : "Norway",
            "align" : "center",
            "variable" : "population",
            "x" : 0.65,
            "color" : "red",
            "y" : 0.7,
            "baseline" : "middle",
            "text" : "Norway is the country\nwith the largest GNI\naccording to 2014 census"
         },
         {
            "variable" : "population",
            "align" : "center",
            "sample" : "China",
            "baseline" : "middle",
            "y" : 0.1,
            "color" : "red",
            "x" : 0.15,
            "text" : "China is the country with\nthe largest population\naccording to 2014 census"
         }
      ]
   },
   "axisAlgorithm" : "rPretty",
   "widthFactor" : 4,
   "colorBy" : "GNI",
   "showTransition" : false,
   "legendPosition" : "top",
   "graphType" : "Stacked"
}
                

 
 

Graph Configuration

{
   "graphType" : "Bar",
   "title" : "Simple Bar graph with annotations",
   "decorations" : {
      "marker" : [
         {
            "text" : "p < 0.01 ***",
            "type" : "annotation",
            "fontSize" : 12,
            "sample" : "Sample1",
            "variable" : "Variable1"
         },
         {
            "fontSize" : 12,
            "sample" : "Sample2",
            "variable" : "Variable1",
            "text" : "p < 0.05 **",
            "type" : "annotation"
         }
      ]
   },
   "colorScheme" : "CanvasXpress",
   "graphOrientation" : "vertical"
}
                

 
 

Graph Configuration

{
   "smpLabelRotate" : 90,
   "axisTitleFontStyle" : "italic",
   "legendColumns" : 2,
   "title" : "Iris flower data set",
   "colorScheme" : "CanvasXpress",
   "smpTitle" : "Species",
   "graphOrientation" : "vertical",
   "graphType" : "Bar",
   "decorations" : {
      "marker" : [
         {
            "x" : 0.4,
            "y" : 0.85,
            "text" : "Species with\\nlowest petal\\nwidth",
            "sample" : "setosa",
            "variable" : "Petal.Width"
         }
      ]
   },
   "xAxis2Show" : false,
   "showTransition" : false,
   "legendPosition" : "bottom"
}
                

 
 

Graph Configuration

{
   "title" : "Random data set",
   "graphOrientation" : "vertical",
   "smpTitle" : "Sample Title",
   "smpLabelRotate" : 45,
   "xAxis2Show" : false,
   "theme" : "CanvasXpress",
   "fontStyle" : "bold italic",
   "plotByVariable" : true,
   "graphType" : "Bar",
   "legendFontStyle" : "italic",
   "smpLabelFontStyle" : "italic",
   "smpLabelInterval" : 2
}
                

 
 

Graph Configuration

{
   "axisTitleFontStyle" : "italic",
   "smpTitleFontStyle" : "bold",
   "title" : "Random data set",
   "smpTitle" : "Cell Lines",
   "graphOrientation" : "vertical",
   "colorScheme" : "CanvasXpress",
   "graphType" : "Bar",
   "showFunctionNamesAfterRender" : false,
   "xAxis2Show" : false,
   "decorations" : {
      "line" : [
         {
            "width" : 2,
            "color" : "rgb(255,0,0)",
            "value" : 50,
            "align" : "left",
            "label" : "Cutoff"
         }
      ]
   },
   "decorationScaleFontFactor" : 1.3,
   "legendBox" : true,
   "colorBy" : "Drug Sensitivity"
}
                

 
 

Graph Configuration

{
   "smpTitle" : "Cell Lines",
   "graphOrientation" : "vertical",
   "title" : "Random data set",
   "axisTitleFontStyle" : "italic",
   "smpOverlays" : [
      "Drug Sensitivity"
   ],
   "smpTitleFontStyle" : "bold",
   "colorBy" : "IC50",
   "decorationScaleFontFactor" : 1.3,
   "decorations" : {
      "line" : [
         {
            "value" : 50,
            "label" : "Cutoff",
            "align" : "left",
            "width" : 2,
            "color" : "rgb(255,0,0)"
         }
      ]
   },
   "theme" : "CanavasXpress",
   "xAxis2Show" : false,
   "graphType" : "Bar"
}
                

 
 

Graph Configuration

{
   "barType" : "lollipop",
   "barLollipopFactor" : 3,
   "graphType" : "Bar",
   "widthFactor" : 0.1,
   "showTransition" : false,
   "colorScheme" : "CanvasXpress"
}
                

 
 

Graph Configuration

{
   "widthFactor" : 1.2,
   "colorScheme" : "CanvasXpress",
   "x3DRatio" : 0.5,
   "is3DPlot" : true,
   "graphType" : "Bar",
   "scatterType" : "bar"
}
                

 
 

Graph Configuration

{
   "objectColorTransparency" : 0.5,
   "swimEnd" : "end",
   "smpOverlays" : [
      "Durable"
   ],
   "barType" : "swimmer",
   "objectBorderColor" : false,
   "colorScheme" : "CanvasXpress",
   "title" : "Tumor Response with Duration by Stage and Month",
   "swimHighCap" : "High Cap",
   "groupingFactors" : [
      "Subject"
   ],
   "graphType" : "Bar",
   "swimDurable" : "Durable",
   "colorBy" : "Stage",
   "swimHigh" : "high",
   "xAxisTitle" : "Duration of Treatment in Months",
   "swimStatus" : "Status",
   "swimStart" : "start",
   "graphOrientation" : "horizontal"
}
                

 
 

Graph Configuration

{
   "colorBy" : "Stage",
   "smpOverlayProperties" : {
      "Durable" : {
         "position" : "bottom"
      },
      "Response" : {
         "type" : "Bar",
         "position" : "bottom",
         "thickness" : 100
      }
   },
   "swimHigh" : "high",
   "swimDurable" : "Durable",
   "graphType" : "Bar",
   "groupingFactors" : [
      "Subject"
   ],
   "swimHighCap" : "High Cap",
   "graphOrientation" : "vertical",
   "swimStart" : "start",
   "swimStatus" : "Status",
   "xAxisTitle" : "Duration of Treatment in Months",
   "swimEnd" : "end",
   "theme" : "CanvasXpress",
   "objectColorTransparency" : 0.5,
   "title" : "Tumor Response with Duration by Stage and Month",
   "objectBorderColor" : false,
   "barType" : "swimmer",
   "smpOverlays" : [
      "Durable",
      "Response"
   ]
}