{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/plain": [] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def plot = new Plot(title: \"Setting 2nd Axis bounds\")\n", "def ys = [0, 2, 4, 6, 15, 10]\n", "def ys2 = [-40, 50, 6, 4, 2, 0]\n", "def ys3 = [3, 6, 3, 6, 70, 6]\n", "plot << new YAxis(label:\"Spread\")\n", "plot << new Line(y: ys)\n", "plot << new Line(y: ys2, yAxis: \"Spread\")\n", "//plot << new Line(y: ys3, yAxis: \"Spread\")\n", "//plot.getYAxes()[0].setBound(1,5);\n", "//plot.getYAxes()[1].setBound(3,6) // this should change the bounds of the 2nd, right axis\n", "plot\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/plain": [] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def plot = new CategoryPlot()\n", "plot << new YAxis(label:\"nd\")\n", "plot << new CategoryBars(value: [[1, 2, 3], [1, 3, 5]])\n", "plot << new CategoryBars(value: [[5, 5, 5], [6,7, 8]], yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(1,5)\n", "plot.getYAxes()[1].setBound(-20,20) // this should change the bounds of the 2nd, right axis\n", "plot" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/plain": [] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def plot = new Plot();\n", "def y1 = [1.5, 1, 6, 5, 2, 8]\n", "plot << new YAxis(label:\"nd\")\n", "def cs = [Color.black, Color.red, Color.gray, Color.green, Color.blue, Color.pink]\n", "def ss = [StrokeType.SOLID, StrokeType.SOLID, StrokeType.DASH, StrokeType.DOT, StrokeType.DASHDOT, StrokeType.LONGDASH]\n", "//plot.getYAxes()[0].setBound(-5,5)\n", "plot.getYAxes()[1].setBound(0,20)\n", "plot << new Stems(y: y1, color: cs, style: ss, width: 5, yAxis: \"nd\")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/plain": [] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def plot = new Plot(title: \"Bars\")\n", "def cs = [new Color(255, 0, 0, 128)] * 5 // transparent bars\n", "def cs1 = [new Color(0, 0, 0, 128)] * 5 // transparent bars\n", "plot << new YAxis(label:\"nd\")\n", "cs[3] = Color.red // set color of a single bar, solid colored bar\n", "plot << new Bars(x: (1..5), y: [3, 6, 5, 99, 8], color: cs, outlineColor: Color.black, width: 0.3)\n", "plot << new Bars(x: (1..5), y: [1, 2, 3, 4, 11], color: cs1, outlineColor: Color.black, width: 0.3, yAxis: \"nd\")\n", "//plot.getYAxes()[1].setBound(0,5)\n", "plot" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/plain": [] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def plot = new Plot(title: \"Changing Point Size, Color, Shape\")\n", "def y1 = [6, 7, 12, 11, 8, 14]\n", "def y2 = y1.collect { it - 2 }\n", "def y3 = y2.collect { it - 2 }\n", "def y4 = y3.collect { it - 2 }\n", "plot << new YAxis(label:\"nd\")\n", "plot << new Points(y: y1)\n", "plot << new Points(y: y2, shape: ShapeType.CIRCLE, yAxis: \"nd\")\n", "plot << new Points(y: y3, size: 8.0, shape: ShapeType.DIAMOND)\n", "plot << new Points(y: y4, size: 12.0, color: Color.orange, outlineColor: Color.red)\n", "plot.getYAxes()[1].setBound(5,10)\n", "plot" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/plain": [] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def p = new Plot()\n", "p << new YAxis(label:\"nd\")\n", "p << new Line(y: [3, 6, 12, 24], displayName: \"Median\")\n", "p << new Area(y: [4, 8, 16, 32], base: [2, 4, 8, 16],\n", " color: new Color(255, 0, 0, 50), displayName: \"Q1 to Q3\", yAxis: \"nd\")\n", "p.getYAxes()[1].setBound(0,100)\n", "p" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "deletable": true, "editable": true }, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "beakerx_kernel_parameters": { "classpath": [], "imports": [ "com.twosigma.beaker.easyform.EasyForm", "com.github.lwhite1.tablesaw.api.ml.regression.*", "static com.twosigma.beaker.mimetype.MIMEContainer.VimeoVideo", "static com.twosigma.beaker.mimetype.FileLinkContainer.FileLinks", "com.twosigma.beaker.chart.Color", "com.github.lwhite1.tablesaw.api.*", "static com.twosigma.beaker.mimetype.MIMEContainer.IFrame", "com.twosigma.beaker.NamespaceClient", "com.twosigma.beaker.jvm.object.OutputCell", "com.github.lwhite1.tablesaw.filtering.*", "static com.twosigma.beaker.mimetype.MIMEContainer.HTML", "static com.twosigma.beaker.mimetype.MIMEContainer.Javascript", "static com.twosigma.beaker.mimetype.FileLinkContainer.FileLink", "static com.twosigma.beaker.mimetype.MIMEContainer.ScribdDocument", "static com.twosigma.beaker.mimetype.SVGContainer.SVG", "com.twosigma.beaker.mimetype.MIMEContainer", "com.twosigma.beaker.chart.histogram.*", "static com.github.lwhite1.tablesaw.api.QueryHelper.*", "com.twosigma.beaker.chart.heatmap.HeatMap", "com.twosigma.beaker.chart.xychart.*", "static com.twosigma.beaker.mimetype.ImageContainer.Image", "com.github.lwhite1.tablesaw.api.ml.clustering.*", "com.twosigma.beaker.chart.Filter", "static java.lang.Math.*", "static com.twosigma.beaker.mimetype.MIMEContainer.YoutubeVideo", "static com.twosigma.beaker.mimetype.MIMEContainer.Math", "com.twosigma.beaker.fileloader.CsvPlotReader", "static com.twosigma.beaker.mimetype.MIMEContainer.Markdown", "java.util.concurrent.TimeUnit", "com.twosigma.beaker.chart.categoryplot.plotitem.*", "static com.twosigma.beaker.mimetype.MIMEContainer.Video", "com.twosigma.beaker.chart.categoryplot.*", "static com.twosigma.beaker.mimetype.MIMEContainer.Latex", "com.twosigma.beaker.chart.xychart.plotitem.*", "com.twosigma.beaker.table.*", "com.twosigma.beaker.chart.KeyboardCodes", "com.twosigma.beaker.chart.GradientColor", "com.github.lwhite1.tablesaw.columns.*", "com.twosigma.beaker.chart.legend.*", "com.github.lwhite1.tablesaw.reducing.*" ] }, "kernelspec": { "display_name": "Groovy", "language": "groovy", "name": "groovy" }, "language_info": { "codemirror_mode": "groovy", "file_extension": ".groovy", "mimetype": "", "name": "Groovy", "nbconverter_exporter": "", "version": "2.4.3" }, "widgets": { "state": { "a92ba8e7-c69a-4431-9436-c09d60dabc01": { "views": [ { "cell_index": 0 } ] }, "f3a1df93-5fc3-423e-a42f-3aaa8a4ce5e8": { "views": [ { "cell_index": 1 } ] } }, "version": "1.2.0" } }, "nbformat": 4, "nbformat_minor": 1 }