Histogram


In [ ]:
// Generate some random data

Random random = new Random();
dataH1 = [];
dataH2 = [];

(1..10000).each {
  dataH1 << random.nextGaussian();
  dataH2 << 2*random.nextGaussian() + 1.0;
}
OutputCell.HIDDEN

In [ ]:
new Histogram(data: dataH1, binCount: 25);

In [ ]:
new Histogram(initWidth:444, initHeight:400,
              title:"Wide Histogram with Manual Parameters",
              xLabel:"Size",
              yLabel:"Count",
              rangeMin: -8, 
              rangeMax: 8, 
              data: dataH1 + [7]*200,
              binCount: 99, 
              color: new Color(0, 154, 166));

In [ ]:
new Histogram(title:"Default is Overlap",
              initWidth:600, initHeight:400, 
              data: [dataH1, dataH2],
              binCount: 25,
              names: ["old and tired 1", "new and improved 2"],
              color: [new Color(0, 154, 166),
                      new Color(230, 50, 50, 128) // transparent!
                     ]);

In [ ]:
new Histogram(title:"Stack",
              initWidth:600, initHeight:400,
              displayMode: Histogram.DisplayMode.STACK,
              data: [dataH1, dataH2],
              binCount: 25,
              names: ["old and tired 1", "new and improved 2"])

In [ ]:
new Histogram(title:"Side by Side",
              displayMode: Histogram.DisplayMode.SIDE_BY_SIDE,
              data: [dataH1,dataH2], 
              binCount: 25)

In [ ]:
new Histogram(title:"Cumulative",
              cumulative: true,
              data: dataH1,
              binCount: 55);

In [ ]:
new Histogram(title:"Normed, Area = 1.0",
              normed: true,
              data: dataH1,
              binCount: 55);

In [ ]:
new Histogram(title:"Log",
              log: true,  
              data: dataH1,
              binCount: 55);

Levels Of Detail


In [ ]:
// generate a random walk
steps = 10000
random = new Random()
def walk(ssize) {
  def cur = 0.0
  def x = []
  def y = []
  for (i in 0..steps) {
    y[i] = cur
    x[i] = i
    cur += random.nextGaussian() * ssize
  }
  return [x:x, y:y]
}
// now x is time for the x-axis, and y is the random variable
beer = walk(10)
whiskey = walk(100)

p = new TimePlot(title: "Drunken Sailor Walks", showLegend: true, lodThreshold: 2000)
p << new Line(x:beer.x, y:beer.y, displayName:"Beer Walk")
p << new Line(x:whiskey.x, y:whiskey.y, displayName:"Whiskey Walk")

Heatmap


In [ ]:
dataHM  = [[533.08714795974, 484.92105712087596, 451.63070008303896, 894.4451947886148,   335.44965728686225, 640.9424094527392, 776.2709495045433, 621.8819257981404,   793.2905673902735, 328.97078791524234, 139.26962328268513, 800.9314566259062,   629.0795214099808, 418.90954534196544, 513.8036215424278, 742.9834968485734,   542.9393528649774, 671.4256827205828, 507.1129322933082, 258.8238039352692,   581.0354187924672, 190.1830169180297, 480.461111816312, 621.621218137835,   650.6023460248642, 635.7577683708486, 605.5201537254429, 364.55368485516846,   554.807212844458, 526.1823154945637],  [224.1432052432479, 343.26660237811336, 228.29828973027486, 550.3809606942758,   340.16890889700994, 214.05332637480836, 461.3159325548031, 471.2546571575069,   503.071081294441, 757.4281483575993, 493.82140462579406, 579.4302306011925,   459.76905409338497, 580.1282535427403, 378.8722877921564, 442.8806517248869,   573.9346962907078, 449.0587543606964, 383.50503527041144, 378.90761994599256,   755.1883447435789, 581.6815170672886, 426.56807864689773, 602.6727518023347,   555.6481983927658, 571.1201152862207, 372.24744704437876, 424.73180136220844,   739.9173564499195, 462.3257604373609],  [561.8684320610753, 604.2859791599086, 518.3421287392559, 524.6887104615442,   364.41920277904774, 433.37737233751386, 565.0508404421712, 533.6030951907703,   306.68809206630397, 738.7229466356732, 766.9678519097575, 699.8457506281374,   437.0340850742263, 802.4400914789037, 417.38754410115075, 907.5825538527938,   521.4281410545287, 318.6109350534576, 435.8275858900637, 463.82924688853524,   533.4069709666686, 404.50516534982546, 332.6966202103611, 560.0346672408426,   436.9691072984075, 631.3453929454839, 585.1581992195356, 522.3209865675237,   497.57041075817443, 525.8867246757814],  [363.4020792898871, 457.31257834906256, 333.21325206873564, 508.0466632081777,   457.1905718373847, 611.2168422907173, 515.2088862309242, 674.5569500790505,   748.0512665828364, 889.7281605626981, 363.6454276219251, 647.0396659692233,   574.150119779024, 721.1853645071792, 309.5388283799724, 450.51745569875845,   339.1271937333267, 630.6976744426033, 630.1571298446103, 615.0700456998867,   780.7843408745639, 205.13803869051543, 784.5916902014255, 498.10545868387925,   553.936345186856, 207.59216580556847, 488.12270849418735, 422.6667046886397,   292.1061953879919, 565.1595338825396],  [528.5186504364794, 642.5542319036714, 563.8776991112292, 537.0271437681837,   430.4056097950834, 384.50193545472877, 693.3404035076994, 573.0278734604005,   261.2443087970927, 563.412635691231, 258.13860041989085, 550.150017102056,   477.70582135030617, 509.4311099345934, 661.3308013433317, 523.1175760654914,   370.29659041946326, 557.8704186019502, 353.66591951113645, 510.5389425077261,   469.11212447314324, 626.2863927887214, 318.5642686423241, 141.13900677851177,   486.00711121264453, 542.0075639686526, 448.7161764573215, 376.65492084577164,   166.56246586635706, 718.6147921685923],  [435.403218786657, 470.74259129379413, 615.3542648093958, 483.61792559031693,   607.9455289424717, 454.9949861614464, 869.45041758392, 750.3595195751914,   754.7958625343501, 508.38715645396553, 368.2779213892305, 662.23752125613,   350.46366230046397, 619.8010888063362, 497.9560438683688, 420.64163974607766,   487.16698403905633, 273.3352931767504, 354.02637708217384, 457.9408818614016,   496.2986534025747, 364.84710143814976, 458.29907844925157, 634.073520178434,   558.7161089429649, 603.6634230782621, 514.1019407724017, 539.6741842214251,   585.0639516732675, 488.3003071211236],  [334.0264519516021, 459.5702037859653, 543.8547654459309, 471.6623772418301,   500.98627686914386, 740.3857774449933, 487.4853744264201, 664.5373560191691,   573.764159193263, 471.32565842016527, 448.8845519093864, 729.3173859836543,   453.34766656988694, 428.4975196541853, 575.1404740691066, 190.18782164376034,   243.90403003048107, 430.03959300145215, 429.08666492876233, 508.89662188951297,   669.6400651031191, 516.2894766192492, 441.39320293407405, 653.1948574772491,   529.6831617222962, 176.0833629734244, 568.7136007686755, 461.66494617366294,   443.39303344518356, 840.642834252332],  [347.676690455591, 475.0701395711058, 383.94468812449156, 456.7512619303556,   547.1719187673109, 224.69458657065758, 458.98685335259506, 599.8561007491281,   231.02565460233575, 610.5318803183029, 763.3423474509603, 548.8104762105211,   445.95788564834953, 844.6566709331175, 591.2236009653337, 586.0438760821825,   399.6820689195621, 395.17360423878256, 535.9853351258233, 332.27242110850426,   801.7584039310705, 190.6337233666032, 805.700536966829, 799.6824375238089,   346.29917202656327, 611.7423892505719, 705.8824305058062, 535.9691379719488,   488.1708623023391, 604.3772264289142],  [687.7108994865216, 483.44749361779685, 661.8182197739575, 591.5452701990528,   151.60961549943875, 524.1475889465452, 745.1142999852398, 665.6103992924466,   701.3015233859578, 648.9854638583182, 403.08097902196505, 384.97216329583586,   442.52161997463816, 590.5026536093199, 219.04366558018955, 899.2103705796073,   562.4908789323547, 666.088957218587, 496.97593850278065, 777.9572405840922,   531.7316118485633, 500.7782009017233, 646.4095967934252, 633.5713368259554,   608.1857007168994, 585.4020395597571, 490.06193749044934, 463.884131549627,   632.7981360348942, 634.8055942938928],  [482.5550451528366, 691.7011356960619, 496.2851035642388, 529.4040886765091,   444.3593296445004, 198.06208336708823, 365.6472909266031, 391.3885069938369,   859.494451604626, 275.19483951927816, 568.4478784631463, 203.74971298680123,   676.2053582803082, 527.9859302404323, 714.4565600799949, 288.9012675397431,   629.6056652113498, 326.2525932990075, 519.5740740263301, 696.8119752318905,   347.1796230415255, 388.6576994098651, 357.54758351840974, 873.5528483422207,   507.0189947052724, 508.1981784529926, 536.9527958233257, 871.2838601964829,   361.93416709279154, 496.5981745168124]]
dataHM2 = [[103,104,104,105,105,106,106,106,107,107,106,106,105,105,104,104,104,104,105,107,107,106,105,105,107,108,109,110,110,110,110,110,110,109,109,109,109,109,109,108,107,107,107,107,106,106,105,104,104,104,104,104,104,104,103,103,103,103,102,102,101,101,100,100,100,100,100,99,98,97,97,96,96,96,96,96,96,96,95,95,95,94,94,94,94,94,94],  [104,104,105,105,106,106,107,107,107,107,107,107,107,106,106,106,106,106,106,108,108,108,106,106,108,109,110,110,112,112,113,112,111,110,110,110,110,109,109,109,108,107,107,107,107,106,106,105,104,104,104,104,104,104,104,103,103,103,103,102,102,101,101,100,100,100,100,99,99,98,97,97,96,96,96,96,96,96,96,95,95,95,94,94,94,94,94],  [104,105,105,106,106,107,107,108,108,108,108,108,108,108,108,108,108,108,108,108,110,110,110,110,110,110,110,111,113,115,116,115,113,112,110,110,110,110,110,110,109,108,108,108,108,107,106,105,105,105,105,105,105,104,104,104,104,103,103,103,102,102,102,101,100,100,100,99,99,98,97,97,96,96,96,96,96,96,96,96,95,95,94,94,94,94,94],  [105,105,106,106,107,107,108,108,109,109,109,109,109,110,110,110,110,110,110,110,111,112,115,115,115,115,115,116,116,117,119,118,117,116,114,113,112,110,110,110,110,110,110,109,109,108,107,106,106,106,106,106,105,105,105,104,104,104,103,103,103,102,102,102,101,100,100,99,99,98,97,97,96,96,96,96,96,96,96,96,95,95,94,94,94,94,94],  [105,106,106,107,107,108,108,109,109,110,110,110,110,111,110,110,110,110,111,114,115,116,121,121,121,121,121,122,123,124,124,123,121,119,118,117,115,114,112,111,110,110,110,110,110,110,109,109,108,109,107,107,106,106,105,105,104,104,104,104,103,103,102,102,102,101,100,100,99,99,98,97,96,96,96,96,96,96,96,96,95,95,94,94,94,94,94],  [106,106,107,107,107,108,109,109,110,110,111,111,112,113,112,111,111,112,115,118,118,119,126,128,128,127,128,128,129,130,129,128,127,125,122,120,118,117,115,114,112,110,110,110,110,110,111,110,110,110,109,109,108,107,106,105,105,105,104,104,104,103,103,102,102,102,101,100,99,99,98,97,96,96,96,96,96,96,96,96,95,95,94,94,94,94,94],  [106,107,107,108,108,108,109,110,110,111,112,113,114,115,114,115,116,116,119,123,125,130,133,134,134,134,134,135,135,136,135,134,132,130,128,124,121,119,118,116,114,112,111,111,111,112,112,111,110,110,110,109,108,108,107,108,107,106,105,104,104,104,103,103,103,102,101,100,99,99,98,97,96,96,96,96,96,96,96,96,95,95,95,94,94,94,94],  [107,107,108,108,109,109,110,110,112,113,114,115,116,117,117,120,120,121,123,129,134,136,138,139,139,139,140,142,142,141,141,140,137,134,131,127,124,122,120,118,117,115,113,114,113,114,114,113,112,111,110,110,109,108,107,106,105,105,105,104,104,104,103,103,103,101,100,100,99,99,98,97,96,96,96,96,96,96,96,96,96,95,95,94,94,94,94],  [107,108,108,109,109,110,111,112,114,115,116,117,118,119,121,125,125,127,131,136,140,141,142,144,144,145,148,149,148,147,146,144,140,138,136,130,127,125,123,121,119,118,117,117,116,116,116,115,114,113,113,111,110,109,108,107,106,105,105,103,103,102,102,102,103,101,100,100,100,99,98,98,97,96,96,96,96,96,96,96,96,95,95,95,94,94,94],  [107,108,109,109,110,110,110,113,115,117,118,119,120,123,126,129,131,134,139,142,144,145,147,148,150,152,154,154,153,154,151,149,146,143,140,136,130,128,126,124,122,121,120,119,118,117,117,117,116,116,115,113,112,110,109,108,107,106,106,105,104,103,102,101,101,100,100,100,100,99,99,98,97,96,96,96,96,96,96,96,96,95,95,95,94,94,94],  [107,108,109,109,110,110,110,112,115,117,119,122,125,127,130,133,137,141,143,145,148,149,152,155,157,159,160,160,161,162,159,156,153,149,146,142,139,134,130,128,126,125,122,120,120,120,119,119,119,118,117,115,113,111,110,110,109,108,107,106,106,105,104,104,103,102,100,100,100,99,99,98,97,96,96,96,96,96,96,96,96,95,95,95,95,94,94],  [108,108,109,109,110,110,110,112,115,118,121,125,128,131,134,138,141,145,147,149,152,157,160,161,163,166,169,170,170,171,168,162,158,155,152,148,144,140,136,132,129,127,124,122,121,120,120,120,120,120,119,117,115,113,110,110,110,110,109,108,108,107,107,106,105,104,102,100,100,100,99,98,97,96,96,96,96,96,96,96,96,96,95,95,95,94,94],  [108,109,109,110,110,111,112,114,117,120,124,128,131,135,138,142,145,149,152,155,158,163,166,167,170,173,175,175,175,173,171,169,164,160,156,153,149,144,140,136,131,129,126,124,123,123,122,121,120,120,120,119,117,115,111,110,110,110,110,110,109,109,110,109,108,106,103,101,100,100,100,98,97,96,96,96,96,96,96,96,96,96,95,95,95,95,94],  [108,109,110,110,110,113,114,116,119,122,126,131,134,138,141,145,149,152,156,160,164,169,171,174,177,175,178,179,177,175,174,172,168,163,160,157,151,147,143,138,133,130,128,125,125,124,123,122,121,121,120,120,118,116,115,111,110,110,110,110,113,114,113,112,110,107,105,102,100,100,100,98,97,96,96,96,96,96,96,96,96,96,96,95,95,95,94],  [108,109,110,110,112,115,116,118,122,125,129,133,137,140,144,149,152,157,161,165,169,173,176,179,179,180,180,180,178,178,176,175,171,165,163,160,153,148,143,139,135,132,129,128,127,125,124,124,123,123,122,122,120,118,117,118,115,117,118,118,119,117,116,115,112,109,107,105,100,100,100,100,97,96,96,96,96,96,96,96,96,96,96,95,95,95,95],  [108,109,110,111,114,116,118,122,127,130,133,136,140,144,148,153,157,161,165,169,173,177,180,180,180,180,181,180,180,180,179,178,173,168,165,161,156,149,143,139,136,133,130,129,128,126,126,125,125,125,125,124,122,121,120,120,120,120,121,122,123,122,120,117,114,111,108,106,105,100,100,100,100,96,96,96,96,96,96,96,96,96,96,96,95,95,95],  [107,108,110,113,115,118,121,126,131,134,137,140,143,148,152,157,162,165,169,173,177,181,181,181,180,181,181,181,180,180,180,178,176,170,167,163,158,152,145,140,137,134,132,130,129,127,127,126,127,128,128,126,125,125,125,123,126,128,129,130,130,125,124,119,116,114,112,110,107,106,105,100,100,100,96,96,96,96,96,96,96,96,96,96,96,95,95],  [107,109,111,116,119,122,125,130,135,137,140,144,148,152,156,161,165,168,172,177,181,184,181,181,181,180,180,180,180,180,180,178,178,173,168,163,158,152,146,141,138,136,134,132,130,129,128,128,130,130,130,129,128,129,129,130,132,133,133,134,134,132,128,122,119,116,114,112,108,106,105,105,100,100,100,97,97,97,97,97,97,97,96,96,96,96,95],  [108,110,112,117,122,126,129,135,139,141,144,149,153,156,160,165,168,171,177,181,184,185,182,180,180,179,178,178,180,179,179,178,176,173,168,163,157,152,148,143,139,137,135,133,131,130,130,131,132,132,132,131,132,132,133,134,136,137,137,137,136,134,131,124,121,118,116,114,111,109,107,106,105,100,100,100,97,97,97,97,97,97,97,96,96,96,96],  [108,110,114,120,126,129,134,139,142,144,146,152,158,161,164,168,171,175,181,184,186,186,183,179,178,178,177,175,178,177,177,176,175,173,168,162,156,153,149,145,142,140,138,136,133,132,132,132,134,134,134,134,135,136,137,138,140,140,140,140,139,137,133,127,123,120,118,115,112,108,108,106,106,105,100,100,100,98,98,98,98,98,98,97,96,96,96],  [108,110,116,122,128,133,137,141,143,146,149,154,161,165,168,172,175,180,184,188,189,187,182,178,176,176,175,173,174,173,175,174,173,171,168,161,157,154,150,148,145,143,141,138,135,135,134,135,135,136,136,137,138,139,140,140,140,140,140,140,140,139,135,130,126,123,120,117,114,111,109,108,107,106,105,100,100,100,99,99,98,98,98,98,97,97,96],  [110,112,118,124,130,135,139,142,145,148,151,157,163,169,172,176,179,183,187,190,190,186,180,177,175,173,170,169,169,170,171,172,170,170,167,163,160,157,154,152,149,147,144,140,137,137,136,137,138,138,139,140,141,140,140,140,140,140,140,140,140,138,134,131,128,124,121,118,115,112,110,109,108,107,106,105,100,100,100,99,99,99,98,98,98,97,97],  [110,114,120,126,131,136,140,143,146,149,154,159,166,171,177,180,182,186,190,190,190,185,179,174,171,168,166,163,164,163,166,169,170,170,168,164,162,161,158,155,153,150,147,143,139,139,139,139,140,141,141,142,142,141,140,140,140,140,140,140,140,137,134,131,128,125,122,119,116,114,112,110,109,109,108,107,105,100,100,100,99,99,99,98,98,97,97],  [110,115,121,127,132,136,140,144,148,151,157,162,169,174,178,181,186,188,190,191,190,184,177,172,168,165,162,159,158,158,159,161,166,167,169,166,164,163,161,159,156,153,149,146,142,142,141,142,143,143,143,143,144,142,141,140,140,140,140,140,140,138,134,131,128,125,123,120,117,116,114,112,110,109,108,107,106,105,102,101,100,99,99,99,98,98,97],  [110,116,121,127,132,136,140,144,148,154,160,166,171,176,180,184,189,190,191,191,191,183,176,170,166,163,159,156,154,155,155,158,161,165,170,167,166,165,163,161,158,155,152,150,146,145,145,145,146,146,144,145,145,144,142,141,140,140,140,140,138,136,134,131,128,125,123,121,119,117,115,113,112,111,111,110,108,106,105,102,100,100,99,99,99,98,98],  [110,114,119,126,131,135,140,144,149,158,164,168,172,176,183,184,189,190,191,191,190,183,174,169,165,161,158,154,150,151,152,155,159,164,168,168,168,167,165,163,160,158,155,153,150,148,148,148,148,148,147,146,146,145,143,142,141,140,139,138,136,134,132,131,128,126,124,122,120,118,116,114,113,113,112,111,108,107,106,105,104,102,100,99,99,99,99],  [110,113,119,125,131,136,141,145,150,158,164,168,172,177,183,187,189,191,192,191,190,183,174,168,164,160,157,153,150,149,150,154,158,162,166,170,170,168,166,164,162,160,158,155,152,151,151,151,151,151,149,148,147,146,145,143,142,140,139,137,135,134,132,131,129,127,125,123,121,119,117,116,114,114,113,112,110,108,107,105,103,100,100,100,100,99,99],  [110,112,118,124,130,136,142,146,151,157,163,168,174,178,183,187,189,190,191,192,189,182,174,168,164,160,157,153,149,148,149,153,157,161,167,170,170,170,168,166,165,163,159,156,154,153,155,155,155,155,152,150,149,147,145,143,141,140,139,138,136,134,133,131,130,128,126,124,122,120,119,117,116,115,114,113,111,110,107,106,105,105,102,101,100,100,100],  [110,111,116,122,129,137,142,146,151,158,164,168,172,179,183,186,189,190,192,193,188,182,174,168,164,161,157,154,151,149,151,154,158,161,167,170,170,170,170,169,168,166,160,157,156,156,157,158,159,159,156,153,150,148,146,144,141,140,140,138,136,135,134,133,131,129,127,125,123,122,120,118,117,116,115,114,112,111,110,108,107,106,105,104,102,100,100],  [108,110,115,121,131,137,142,147,152,159,163,167,170,177,182,184,187,189,192,194,189,183,174,169,165,161,158,156,154,153,154,157,160,164,167,171,172,174,174,173,171,168,161,159,158,158,159,161,161,160,158,155,151,149,147,144,142,141,140,138,137,136,135,134,132,130,128,126,125,123,121,119,118,117,116,115,113,112,112,111,110,109,108,107,105,101,100],  [108,110,114,120,128,134,140,146,152,158,162,166,169,175,180,183,186,189,193,195,190,184,176,171,167,163,160,158,157,156,157,159,163,166,170,174,176,178,178,176,172,167,164,161,161,160,161,163,163,163,160,157,153,150,148,146,144,142,141,140,139,138,136,135,134,133,129,127,126,124,122,121,119,118,117,116,114,113,112,111,110,110,109,109,107,104,100],  [107,110,115,119,123,129,135,141,146,156,161,165,168,173,179,182,186,189,193,194,191,184,179,175,170,166,162,161,160,160,161,162,165,169,172,176,178,179,179,176,172,168,165,163,163,163,163,165,166,164,161,158,155,152,150,147,146,144,143,142,141,139,139,138,137,135,131,128,127,125,124,122,121,119,118,116,115,113,112,111,111,110,110,109,109,105,100],  [107,110,114,117,121,126,130,135,142,151,159,163,167,171,177,182,185,189,192,193,191,187,183,179,174,169,167,166,164,164,165,166,169,171,174,178,179,180,180,178,173,169,166,165,165,166,165,168,169,166,163,159,157,154,152,149,148,147,146,145,143,142,141,140,139,138,133,130,128,127,125,124,122,120,118,117,115,112,111,111,111,111,110,109,108,106,100],  [107,109,113,118,122,126,129,134,139,150,156,160,165,170,175,181,184,188,191,192,192,189,185,181,177,173,171,169,168,167,169,170,172,174,176,178,179,180,180,179,175,170,168,166,166,168,168,170,170,168,164,160,158,155,152,151,150,149,149,148,147,145,144,143,142,141,136,133,130,129,127,125,123,120,119,118,115,112,111,111,111,110,109,109,109,105,100],  [105,107,111,117,121,124,127,131,137,148,154,159,164,168,174,181,184,187,190,191,191,190,187,184,180,178,175,174,172,171,173,173,173,176,178,179,180,180,180,179,175,170,168,166,168,169,170,170,170,170,166,161,158,156,154,153,151,150,150,150,150,148,147,146,145,143,139,135,133,131,129,126,124,121,120,118,114,111,111,111,110,110,109,107,106,104,100],  [104,106,110,114,118,121,125,129,135,142,150,157,162,167,173,180,183,186,188,190,190,190,189,184,183,181,180,179,179,176,177,176,176,177,178,179,180,180,179,177,173,169,167,166,167,169,170,170,170,170,167,161,159,157,155,153,151,150,150,150,150,150,150,149,147,145,141,138,135,133,130,127,125,123,121,118,113,111,110,110,109,109,107,106,105,103,100],  [104,106,108,111,115,119,123,128,134,141,148,154,161,166,172,179,182,184,186,189,190,190,190,187,185,183,180,180,180,179,179,177,176,177,178,178,178,177,176,174,171,168,166,164,166,168,170,170,170,170,168,162,159,157,155,153,151,150,150,150,150,150,150,150,150,148,144,140,137,134,132,129,127,125,122,117,111,110,107,107,106,105,104,103,102,101,100],  [103,105,107,110,114,118,122,127,132,140,146,153,159,165,171,176,180,183,185,186,189,190,188,187,184,182,180,180,180,179,178,176,176,176,176,174,174,173,172,170,168,167,165,163,164,165,169,170,170,170,166,162,159,157,155,153,151,150,150,150,150,150,150,150,150,150,146,142,139,136,133,131,128,125,122,117,110,108,106,105,104,103,103,101,101,101,101],  [102,103,106,108,112,116,121,125,130,138,145,151,157,163,170,174,178,181,181,184,186,186,187,186,184,181,180,180,180,179,178,174,173,173,171,170,170,169,168,167,166,164,163,162,161,164,167,169,170,168,164,160,158,157,155,153,151,150,150,150,150,150,150,150,150,150,147,144,141,138,135,133,128,125,122,116,109,107,104,104,103,102,101,101,101,101,101],  [101,102,105,107,110,115,120,124,129,136,143,149,155,162,168,170,174,176,178,179,181,182,184,184,183,181,180,180,179,177,174,172,170,168,166,165,164,164,164,164,162,160,159,159,158,160,162,164,166,166,163,159,157,156,155,153,151,150,150,150,150,150,150,150,150,150,149,146,143,140,137,133,129,124,119,112,108,105,103,103,102,101,101,101,101,100,100],  [101,102,104,106,109,113,118,122,127,133,141,149,155,161,165,168,170,172,175,176,177,179,181,181,181,180,180,179,177,174,171,167,165,163,161,160,160,160,160,160,157,155,155,154,154,155,157,159,161,161,161,159,156,154,154,153,151,150,150,150,150,150,150,150,150,150,149,147,144,141,137,133,129,123,116,110,107,104,102,102,101,101,101,100,100,100,100],  [102,103,104,106,108,112,116,120,125,129,137,146,154,161,163,165,166,169,172,173,174,175,177,178,178,178,178,177,174,171,168,164,160,158,157,157,156,156,156,155,152,151,150,150,151,151,152,154,156,157,157,156,155,153,152,152,151,150,150,150,150,150,150,150,150,150,150,147,144,141,138,133,127,120,113,109,106,103,101,101,101,100,100,100,100,100,100],  [103,104,105,106,108,110,114,118,123,127,133,143,150,156,160,160,161,162,167,170,171,172,173,175,175,174,174,173,171,168,164,160,156,155,154,153,153,152,152,150,149,148,148,148,148,148,149,149,150,152,152,152,152,151,150,150,150,150,150,150,150,150,150,150,150,150,149,147,144,141,138,132,125,118,111,108,105,103,102,101,101,101,100,100,100,100,100],  [104,105,106,107,108,110,113,117,120,125,129,138,145,151,156,156,157,158,160,164,166,168,170,171,172,171,171,169,166,163,160,156,153,151,150,150,149,149,149,148,146,146,146,146,146,146,146,147,148,148,149,149,149,148,148,148,148,149,149,150,150,150,150,150,150,150,148,146,143,141,136,129,123,117,110,108,105,104,103,102,102,101,101,100,100,100,100],  [103,104,105,106,107,109,111,115,118,122,127,133,140,143,150,152,153,155,157,159,162,164,167,168,168,168,167,166,163,160,157,153,150,148,148,147,147,147,145,145,144,143,143,143,144,144,144,144,145,145,145,145,146,146,146,146,146,147,147,148,149,150,150,150,150,149,147,145,143,141,134,127,123,117,111,108,105,105,104,104,103,103,102,101,100,100,100],  [102,103,104,105,106,107,109,113,116,120,125,129,133,137,143,147,149,151,152,154,158,161,164,165,164,164,163,163,160,157,154,151,149,147,145,145,144,143,141,140,141,141,141,141,141,142,142,142,142,142,142,142,143,143,143,144,144,145,146,146,146,147,148,148,148,148,145,143,142,140,134,128,123,117,112,108,106,105,105,104,104,103,102,101,100,100,99],  [102,103,104,105,105,106,108,110,113,118,123,127,129,132,137,141,142,142,145,150,154,157,161,161,160,160,160,159,157,154,151,148,146,145,143,142,142,139,137,136,137,137,138,138,139,139,139,139,139,139,139,139,140,140,141,142,142,143,144,144,144,145,145,145,145,145,144,142,140,139,136,129,124,119,113,109,106,106,105,104,103,102,101,101,100,99,99],  [102,103,104,104,105,106,107,108,111,116,121,124,126,128,131,134,135,137,139,143,147,152,156,157,157,157,156,155,153,151,148,146,143,142,141,140,138,135,133,132,132,133,133,133,134,135,135,135,135,136,136,137,137,138,138,139,140,141,141,142,142,143,142,142,141,141,140,139,137,134,133,129,125,121,114,110,107,106,106,104,103,102,101,100,99,99,99],  [102,103,104,104,105,105,106,108,110,113,118,121,124,126,128,130,132,134,136,139,143,147,150,154,154,154,153,151,149,148,146,143,141,139,137,136,132,130,128,128,128,129,129,130,130,131,132,132,132,133,134,134,135,135,136,137,138,139,139,140,140,140,139,139,138,137,137,135,132,130,129,127,124,120,116,112,109,106,105,103,102,101,101,100,99,99,99],  [101,102,103,104,104,105,106,107,108,110,114,119,121,124,126,128,129,132,134,137,140,143,147,149,151,151,151,149,147,145,143,141,138,136,134,131,128,126,124,125,125,126,126,127,128,128,129,129,130,130,131,131,132,132,133,134,135,135,136,136,137,137,136,136,135,134,133,131,129,128,127,126,123,119,115,111,109,107,105,104,103,102,101,100,100,100,99],  [101,102,103,103,104,104,105,106,108,110,112,116,119,121,124,125,127,130,132,135,137,140,143,147,149,149,149,147,145,143,141,139,136,133,131,128,125,122,121,122,122,122,123,125,125,126,127,127,127,128,128,128,129,129,130,131,131,132,132,133,133,133,132,132,131,131,130,129,128,126,125,124,121,117,111,109,108,106,105,104,103,102,101,101,100,100,100],  [100,101,102,103,103,104,105,106,107,108,110,114,117,119,121,123,126,128,130,133,136,139,141,144,146,147,146,145,143,141,138,136,133,130,127,124,121,120,120,120,120,120,121,122,123,124,124,125,125,126,126,125,126,126,126,125,126,127,128,128,129,129,128,128,128,128,128,128,126,125,123,122,119,114,109,108,107,106,105,104,103,103,102,102,101,100,100],  [100,101,102,103,104,105,106,107,108,109,110,112,115,117,120,122,125,127,130,132,135,137,139,142,144,144,144,142,140,138,136,132,129,126,123,120,120,119,119,118,119,119,120,120,120,121,122,122,123,123,123,123,122,123,122,122,121,122,122,122,123,123,123,124,125,125,126,126,125,124,122,120,116,113,109,107,106,105,104,104,103,102,102,101,101,100,100],  [100,101,102,103,104,105,106,107,108,109,110,112,114,117,119,122,124,127,129,131,134,136,138,140,142,142,142,140,138,136,133,129,125,122,120,119,118,118,117,116,117,117,118,119,119,120,120,120,121,121,121,122,121,120,120,120,119,119,120,120,120,120,120,120,123,123,124,124,124,123,121,119,114,112,108,106,106,104,104,103,102,102,101,101,100,100,99],  [101,102,103,104,105,106,107,108,109,110,111,113,114,116,119,121,124,126,128,130,133,135,137,138,140,140,139,137,135,133,131,127,122,120,118,118,117,117,116,115,116,116,117,118,118,118,119,119,120,120,121,121,120,119,119,118,117,117,118,119,118,118,118,119,120,122,123,123,123,122,120,117,113,110,108,106,105,104,103,103,102,101,101,100,100,99,99],  [101,102,103,104,105,106,107,108,109,110,111,111,113,115,118,121,123,125,127,129,131,133,135,137,138,138,137,134,132,130,127,122,120,118,116,116,116,116,115,113,114,115,116,117,117,118,118,119,119,119,120,120,119,118,117,117,116,116,117,117,117,118,119,119,119,120,121,121,121,121,119,116,113,110,107,105,105,103,103,103,102,101,100,100,99,99,99],  [101,102,103,104,105,106,107,108,109,110,111,112,114,116,117,120,122,124,126,129,130,132,133,135,136,136,134,132,129,126,122,120,118,116,114,114,114,114,114,113,113,114,115,116,116,117,117,117,118,118,119,119,118,117,116,116,115,115,116,116,116,117,117,118,118,119,120,120,120,120,119,116,113,109,106,104,104,103,102,102,101,101,100,99,99,99,98],  [101,102,103,104,105,106,107,108,109,110,111,113,115,117,117,118,121,123,126,128,130,130,131,132,133,134,131,129,125,122,120,118,116,114,113,112,112,113,112,112,111,112,113,113,114,115,116,116,117,117,118,118,116,116,115,115,115,114,114,115,116,116,117,117,118,118,119,119,120,120,117,115,112,108,106,104,103,102,102,102,101,100,99,99,99,98,98],  [101,102,103,104,105,105,106,107,108,109,110,111,113,115,117,118,120,122,125,126,127,128,129,130,131,131,128,125,121,120,118,116,114,113,113,111,111,111,111,110,109,110,111,112,113,113,114,115,115,116,117,117,116,115,114,114,113,113,114,114,115,115,116,116,117,118,118,119,119,118,116,114,112,108,105,103,103,102,101,101,100,100,99,99,98,98,97],  [100,101,102,103,104,105,106,107,108,109,110,110,111,113,115,118,120,121,122,124,125,125,126,127,128,127,124,121,120,118,116,114,113,112,112,110,109,109,108,108,108,109,110,111,112,112,113,114,114,115,116,116,115,114,113,112,112,113,113,114,114,115,115,116,116,117,117,118,118,117,115,113,111,107,105,103,102,101,101,100,100,100,99,99,98,98,97],  [100,101,102,103,104,105,105,106,107,108,109,110,110,111,114,116,118,120,120,121,122,122,123,124,123,123,120,118,117,115,114,115,113,111,110,109,108,108,107,107,107,108,109,110,111,111,112,113,113,114,115,115,114,113,112,111,111,112,112,112,113,114,114,115,115,116,116,117,117,116,114,112,109,106,104,102,101,100,100,99,99,99,99,98,98,97,97]]
dataHM3 = [[16,29, 12, 14, 16, 5, 9, 43, 25, 49, 57, 61, 37, 66, 79, 55, 51, 55, 17, 29, 9, 4, 9, 12, 9],  [22,6, 2, 12, 23, 9, 2, 4, 11, 28, 49, 51, 47, 38, 65, 69, 59, 65, 59, 22, 11, 12, 9, 9, 13],  [2, 5, 8, 44, 9, 22, 2, 5, 12, 34, 43, 54, 44, 49, 48, 54, 59, 69, 51, 21, 16, 9, 5, 4, 7],  [3, 9, 9, 34, 9, 9, 2, 4, 13, 26, 58, 61, 59, 53, 54, 64, 55, 52, 53, 18, 3, 9, 12, 2, 8],  [4, 2, 9, 8, 2, 23, 2, 4, 14, 31, 48, 46, 59, 66, 54, 56, 67, 54, 23, 14, 6, 8, 7, 9, 8],  [5, 2, 23, 2, 9, 9, 9, 4, 8, 8, 6, 14, 12, 9, 14, 9, 21, 22, 34, 12, 9, 23, 9, 11, 13],  [6, 7, 23, 23, 9, 4, 7, 4, 23, 11, 32, 2, 2, 5, 34, 9, 4, 12, 15, 19, 45, 9, 19, 9, 4]]
OutputCell.HIDDEN

In [ ]:
new HeatMap(data: dataHM)

In [ ]:
new HeatMap(title: "Heatmap Second Example",
            xLabel:"X Label",
            yLabel:"Y Label",
            data: dataHM,
            legendPosition: LegendPosition.TOP)

In [ ]:
new HeatMap(title: "Green Yellow White",
            data: dataHM2,
            showLegend: false,
            color: GradientColor.GREEN_YELLOW_WHITE)

In [ ]:
def colors = [Color.black, Color.yellow, Color.red]
new HeatMap(title: "Custom Gradient Example",
            data: dataHM3,
            color: new GradientColor(colors))

In [ ]:
new HeatMap(initWidth: 900,
            initHeight: 300,
            title: "Custom size, no tooltips",
            data: dataHM3,
            useToolTip: false,
            showLegend: false,
            color: GradientColor.WHITE_BLUE)

TreeMap


In [ ]:
node = new TreeMapNode("0");
def node00 = new TreeMapNode("00", 2, new DefaultValue(2));

def node01 = new TreeMapNode("01");
node01.add(new TreeMapNode("011", 1, new DefaultValue(1)))
node01.add(new TreeMapNode("012", 2, new DefaultValue(1)))
node01.add(new TreeMapNode("013", 3, new DefaultValue(1)))

def node02 = new TreeMapNode("02");
node02.add(new TreeMapNode("020", 2, new DefaultValue(2)))
node02.add(new TreeMapNode("021", 1, new DefaultValue(1)))
node02.add(new TreeMapNode("022", 1, new DefaultValue(1)))
node02.add(new TreeMapNode("023", 1, new DefaultValue(1)))
node02.add(new TreeMapNode("024", 2, new DefaultValue(2)))

def node03 = new TreeMapNode("03");
node03.add(new TreeMapNode("030", 1, new DefaultValue(2)))
node03.add(new TreeMapNode("031", 2, new DefaultValue(2)))
node03.add(new TreeMapNode("032", 3, new DefaultValue(2)))
node03.add(new TreeMapNode("033", 4, new DefaultValue(2)))

def node04 = new TreeMapNode("04", 6, new DefaultValue(5))

node.add(node01)
node.add(node02)
node.add(node03)
node.add(node04)

In [ ]:
def x = new TreeMap(
  root: node,
  showLegend: true,
  title: "Simple TreeChart"
);
x

In [ ]:
def x = new TreeMap(
  root: node,
  mode: Mode.SQUARIFY,
  title: "Mode.SQUARIFY"
);
x

In [ ]:
def x = new TreeMap(
  root: node,
  mode: Mode.SLICE,
  title: "Mode.SLICE"
);
x

In [ ]:
def x = new TreeMap(
  root: node,
  mode: Mode.DICE,
  title: "Mode.DICE"
);
x

In [ ]:
def x = new TreeMap(
  root: node,
  mode: Mode.SLICE_DIC,
  title: "Mode.SLICE_DIC"
);
x

Limit for Heatmap is 100 x 100 elements


In [ ]:
Random random = new Random()
def dataHM4 = []
100.times{
    def subArr = []
    105.times{
        subArr.add(random.nextInt(100))
    }
    dataHM4.add(subArr)
}
new HeatMap(data: dataHM4)

Limit for Histogtam is 1_000_000 elements


In [ ]:
Random random = new Random();
dataH4 = [];

(1..1100000).each {
  dataH4 << random.nextGaussian();
}
new Histogram(data: dataH4, binCount: 10000);

Limit for Treemap is 1000 nodes


In [ ]:
Random random = new Random();
rootNode = new TreeMapNode("0");
    
1100.times{
    n = random.nextInt(10) + 1;
    rootNode.add(new TreeMapNode("g" + n, n, new DefaultValue(n)));    
}

def x = new TreeMap(
  root: rootNode,
  showLegend: true,
  title: "Many nodes TreeChart"
);
x

selecting of nodes in TreeMap by menu


In [ ]:
menuNode = new TreeMapNode("0");
for (i = 1; i <10; i++) {
    nodeX = new TreeMapNode("X" + i)
    nodeX.add(new TreeMapNode("a" + i, i, new DefaultValue(i)))    
    nodeX.add(new TreeMapNode("b" + i, i, new DefaultValue(i))) 
    menuNode.add(nodeX)
}

def x = new TreeMap(
  root: menuNode,
  showLegend: true,
  title: "Menu nodes TreeChart"
);
x

In [ ]: