SHARE
TWEET

Untitled

a guest Sep 16th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {"cells":[{"metadata":{},"cell_type":"markdown","source":"# Histograms"},{"metadata":{},"cell_type":"markdown","source":"In a histogram, the height of each bar (bin) represents the number of data points that fall into its interval.\nThey are generally used to show the distribution of a variable."},{"metadata":{"trusted":true},"cell_type":"code","source":"// Generate some random data\n\nRandom random = new Random();\ndata1 = [];\ndata2 = [];\n\n(1..10000).each {\n  data1 << random.nextGaussian();\n  data2 << 2*random.nextGaussian() + 1.0;\n}\nprint(data1[7])\nOutputCell.HIDDEN","execution_count":1,"outputs":[{"output_type":"stream","text":"1.644606383183776","name":"stdout"}]},{"metadata":{"trusted":true},"cell_type":"code","source":"new Histogram(data: data1, binCount: 25);","execution_count":2,"outputs":[{"output_type":"display_data","data":{"method":"display_data","application/vnd.jupyter.widget-view+json":{"version_minor":0,"model_id":"61e7e727-23cd-4b20-b629-fced4d0f4fad","version_major":2}},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"new Histogram(initWidth:800, initHeight:200,\n              title:\"Wide Histogram with Manual Parameters\",\n              xLabel:\"Size\",\n              yLabel:\"Count\",\n              rangeMin: -8, \n              rangeMax: 8, \n              data: data1 + [7]*200,\n              binCount: 99, \n              color: new Color(0, 154, 166));","execution_count":3,"outputs":[{"output_type":"display_data","data":{"method":"display_data","application/vnd.jupyter.widget-view+json":{"version_minor":0,"model_id":"f83716c2-d066-4db4-938f-b878d2f33624","version_major":2}},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"new Histogram(title:\"Default is Overlap\",\n              data: [data1, data2],\n              binCount: 99,\n              names: [\"old and tired\", \"new and improved\"],\n              color: [new Color(0, 154, 166),\n                      new Color(230, 50, 50, 128) // transparent!\n                     ]);","execution_count":4,"outputs":[{"output_type":"display_data","data":{"method":"display_data","application/vnd.jupyter.widget-view+json":{"version_minor":0,"model_id":"0249d707-0210-4f7e-a6e8-0196831c4cb9","version_major":2}},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"new Histogram(title:\"Stack\",\n              showLegend: false,\n              displayMode: Histogram.DisplayMode.STACK,\n              data: [data1, data2],\n              binCount: 99)","execution_count":5,"outputs":[{"output_type":"display_data","data":{"method":"display_data","application/vnd.jupyter.widget-view+json":{"version_minor":0,"model_id":"6a949c89-cde0-40ef-89b2-d3b9428932bb","version_major":2}},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"new Histogram(title:\"Side by Side\",\n              displayMode: Histogram.DisplayMode.SIDE_BY_SIDE,\n              data: [data1,data2], \n              binCount: 55)","execution_count":6,"outputs":[{"output_type":"display_data","data":{"method":"display_data","application/vnd.jupyter.widget-view+json":{"version_minor":0,"model_id":"bb84cfb5-1034-45d2-86de-ffca7be6206a","version_major":2}},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"new Histogram(title:\"Cumulative\",\n              cumulative: true,\n              data: data1,\n              binCount: 55);","execution_count":7,"outputs":[{"output_type":"display_data","data":{"method":"display_data","application/vnd.jupyter.widget-view+json":{"version_minor":0,"model_id":"e3cc6c5f-3874-4327-9304-957fdd1f2210","version_major":2}},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"In a *normed* histogram, the height of the bars is scaled so the area under the histogram is unity."},{"metadata":{"trusted":true},"cell_type":"code","source":"new Histogram(title:\"Normed, Area = 1.0\",\n              normed: true,\n              data: data1,\n              binCount: 55);","execution_count":8,"outputs":[{"output_type":"display_data","data":{"method":"display_data","application/vnd.jupyter.widget-view+json":{"version_minor":0,"model_id":"1e6bd2b6-bb19-40e7-85c3-d9848b260cb0","version_major":2}},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"new Histogram(log: true,  \n              data: data1,\n              binCount: 99);","execution_count":9,"outputs":[{"output_type":"display_data","data":{"method":"display_data","application/vnd.jupyter.widget-view+json":{"version_minor":0,"model_id":"3a60e3d4-3c33-4416-99f6-44f1c81c723d","version_major":2}},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"anaconda-cloud":{},"beakerx_kernel_parameters":{},"kernelspec":{"name":"groovy","display_name":"Groovy","language":"groovy"},"language_info":{"nbconverter_exporter":"","codemirror_mode":"groovy","name":"Groovy","mimetype":"","file_extension":".groovy","version":"2.5.6"},"toc":{"nav_menu":{},"number_sections":false,"sideBar":false,"skip_h1_title":false,"base_numbering":1,"title_cell":"Table of Contents","title_sidebar":"Contents","toc_cell":false,"toc_position":{},"toc_section_display":false,"toc_window_display":false}},"nbformat":4,"nbformat_minor":1}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top