{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"Default scale\")\n", "def ys = [0, 3, 4, 6, 8, 10]\n", "def ys2 = [1, 3, 4, 7, 9, 11]\n", "plot << new YAxis(label:\"Spread\")\n", "plot << new Line(y: ys)\n", "plot << new Line(y: ys2, yAxis: \"Spread\")\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"The same scale\")\n", "def ys = [0, 3, 4, 6, 8, 10]\n", "def ys2 = [1, 3, 4, 7, 9, 11]\n", "plot << new YAxis(label:\"Spread\")\n", "plot << new Line(y: ys)\n", "plot << new Line(y: ys2, yAxis: \"Spread\")\n", "plot.getYAxes()[0].setBound(1, 11);\n", "plot.getYAxes()[1].setBound(1, 11);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"2nd YAxis is zoomed\")\n", "def ys = [0, 3, 4, 6, 8, 10]\n", "def ys2 = [1, 3, 4, 7, 9, 11]\n", "plot << new YAxis(label:\"Spread\")\n", "plot << new Line(y: ys)\n", "plot << new Line(y: ys2, yAxis: \"Spread\")\n", "plot.getYAxes()[0].setBound(0, 10);\n", "plot.getYAxes()[1].setBound(0, 7);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new CategoryPlot(title: \"Default scale\")\n", "def cs = [new Color(255, 0, 0, 128)] * 5 // transparent color\n", "def cs1 = [new Color(0, 0, 0, 128)] * 5 // transparent color\n", "plot << new YAxis(label:\"nd\")\n", "plot << new CategoryBars(value: [[4, 4, 4, 8], [5, 5, 5, 9]], color: cs)\n", "plot << new CategoryBars(value: [[2, 4, 6, 8], [3, 5, 7, 9]], color: cs1, yAxis: \"nd\")\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new CategoryPlot(title: \"The same scale\")\n", "def cs = [new Color(255, 0, 0, 128)] * 5 // transparent color\n", "def cs1 = [new Color(0, 0, 0, 128)] * 5 // transparent color\n", "plot << new YAxis(label:\"nd\")\n", "plot << new CategoryBars(value: [[4, 4, 4, 8], [5, 5, 5, 9]], color: cs)\n", "plot << new CategoryBars(value: [[2, 4, 6, 8], [3, 5, 7, 9]], color: cs1, yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(0, 11);\n", "plot.getYAxes()[1].setBound(0, 11);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new CategoryPlot(title: \"2nd YAxis is zoomed\")\n", "def cs = [new Color(255, 0, 0, 128)] * 5 // transparent color\n", "def cs1 = [new Color(0, 0, 0, 128)] * 5 // transparent color\n", "plot << new YAxis(label:\"nd\")\n", "plot << new CategoryBars(value: [[4, 4, 4, 8], [5, 5, 5, 9]], color: cs)\n", "plot << new CategoryBars(value: [[2, 4, 6, 8], [3, 5, 7, 9]], color: cs1, yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(0, 9);\n", "plot.getYAxes()[1].setBound(0, 7);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"Default scale\");\n", "plot << new YAxis(label:\"nd\")\n", "def ss = [StrokeType.DASH, StrokeType.DASH, StrokeType.DASH, StrokeType.DASH, StrokeType.DASH]\n", "plot << new Stems(y: [4, 4, 4, 8, 9], width: 2)\n", "plot << new Stems(y: [2, 4, 6, 5, 9], width: 6, style: ss, yAxis: \"nd\")\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"The same scale\");\n", "plot << new YAxis(label:\"nd\")\n", "def ss = [StrokeType.DASH, StrokeType.DASH, StrokeType.DASH, StrokeType.DASH, StrokeType.DASH]\n", "plot << new Stems(y: [4, 4, 4, 8, 9], width: 2)\n", "plot << new Stems(y: [2, 4, 6, 5, 9], width: 6, style: ss, yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(0, 11);\n", "plot.getYAxes()[1].setBound(0, 11);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"2nd YAxis is zoomed\");\n", "plot << new YAxis(label:\"nd\")\n", "def ss = [StrokeType.DASH, StrokeType.DASH, StrokeType.DASH, StrokeType.DASH, StrokeType.DASH]\n", "plot << new Stems(y: [4, 4, 4, 8, 9], width: 2)\n", "plot << new Stems(y: [2, 4, 6, 5, 9], width: 6, style: ss, yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(0, 9);\n", "plot.getYAxes()[1].setBound(0, 7);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"Default scale\")\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", "plot << new Bars(y: [4, 4, 4, 8, 9], color: cs, width: 0.3)\n", "plot << new Bars(y: [2, 4, 6, 5, 9], color: cs1, width: 0.3, yAxis: \"nd\")\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"The same scale\")\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", "plot << new Bars(y: [4, 4, 4, 8, 9], color: cs, width: 0.3)\n", "plot << new Bars(y: [2, 4, 6, 5, 9], color: cs1, width: 0.3, yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(0, 11);\n", "plot.getYAxes()[1].setBound(0, 11);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"2nd YAxis is zoomed\")\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", "plot << new Bars(y: [4, 4, 4, 8, 9], color: cs, width: 0.3)\n", "plot << new Bars(y: [2, 4, 6, 5, 9], color: cs1, width: 0.3, yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(0, 9);\n", "plot.getYAxes()[1].setBound(0, 7);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"Default scale\")\n", "plot << new YAxis(label:\"nd\")\n", "plot << new Points(y: [4, 4, 4, 8, 9], size: 12.0, shape: ShapeType.CIRCLE)\n", "plot << new Points(y: [2, 4, 6, 5, 9], size: 5.0, shape: ShapeType.CIRCLE, yAxis: \"nd\")\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"The same scale\")\n", "plot << new YAxis(label:\"nd\")\n", "plot << new Points(y: [4, 4, 4, 8, 9], size: 12.0, shape: ShapeType.CIRCLE)\n", "plot << new Points(y: [2, 4, 6, 5, 9], size: 5.0, shape: ShapeType.CIRCLE, yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(0, 11);\n", "plot.getYAxes()[1].setBound(0, 11);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"2nd YAxis is zoomed\")\n", "plot << new YAxis(label:\"nd\")\n", "plot << new Points(y: [4, 4, 4, 8, 9], size: 12.0, shape: ShapeType.CIRCLE)\n", "plot << new Points(y: [2, 4, 6, 5, 9], size: 5.0, shape: ShapeType.CIRCLE, yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(0, 9);\n", "plot.getYAxes()[1].setBound(0, 7);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"Default scale\")\n", "plot << new YAxis(label:\"nd\")\n", "plot << new Area(y: [4, 4, 4, 8, 9])\n", "plot << new Area(y: [2, 4, 6, 5, 9], yAxis: \"nd\")\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"The same scale\")\n", "plot << new YAxis(label:\"nd\")\n", "plot << new Area(y: [4, 4, 4, 8, 9])\n", "plot << new Area(y: [2, 4, 6, 5, 9], yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(0, 11);\n", "plot.getYAxes()[1].setBound(0, 11);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def plot = new Plot(title: \"2nd YAxis is zoomed\")\n", "plot << new YAxis(label:\"nd\")\n", "plot << new Area(y: [4, 4, 4, 8, 9])\n", "plot << new Area(y: [2, 4, 6, 5, 9], yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(0, 9);\n", "plot.getYAxes()[1].setBound(0, 7);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def cs1 = [new Color(255, 0, 0, 128)] * 5 // transparent bars\n", "def cs2 = [new Color(0, 0, 0, 128)] * 5 // transparent bars\n", "def ss = [StrokeType.DASH, StrokeType.DASH, StrokeType.DASH, StrokeType.DASH, StrokeType.DASH]\n", "def y1 = [4, 4, 4, 8, 9]\n", "def y2 = [2, 4, 6, 5, 9]\n", "\n", "def plot = new Plot(title: \"Default scale\")\n", "plot << new YAxis(label: \"nd\")\n", "plot << new Line(y: y1)\n", "plot << new Points(y: y1, size: 12.0, shape: ShapeType.CIRCLE)\n", "plot << new Bars(y: y1, color: cs1, width: 0.3)\n", "plot << new Stems(y: [4, 4, 4, 8, 9], width: 2)\n", "plot << new Line(y: y2, yAxis: \"nd\")\n", "plot << new Points(y: y2, size: 5.0, shape: ShapeType.CIRCLE, yAxis: \"nd\")\n", "plot << new Bars(y: y2, color: cs2, width: 0.3, yAxis: \"nd\")\n", "plot << new Stems(y: [2, 4, 6, 5, 9], width: 6, style: ss, yAxis: \"nd\")\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def cs1 = [new Color(255, 0, 0, 128)] * 5 // transparent bars\n", "def cs2 = [new Color(0, 0, 0, 128)] * 5 // transparent bars\n", "def ss = [StrokeType.DASH, StrokeType.DASH, StrokeType.DASH, StrokeType.DASH, StrokeType.DASH]\n", "def y1 = [4, 4, 4, 8, 9]\n", "def y2 = [2, 4, 6, 5, 9]\n", "\n", "def plot = new Plot(title: \"The same scale\")\n", "plot << new YAxis(label: \"nd\")\n", "plot << new Line(y: y1)\n", "plot << new Points(y: y1, size: 12.0, shape: ShapeType.CIRCLE)\n", "plot << new Bars(y: y1, color: cs1, width: 0.3)\n", "plot << new Stems(y: [4, 4, 4, 8, 9], width: 2)\n", "plot << new Line(y: y2, yAxis: \"nd\")\n", "plot << new Points(y: y2, size: 5.0, shape: ShapeType.CIRCLE, yAxis: \"nd\")\n", "plot << new Bars(y: y2, color: cs2, width: 0.3, yAxis: \"nd\")\n", "plot << new Stems(y: [2, 4, 6, 5, 9], width: 6, style: ss, yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(0, 11);\n", "plot.getYAxes()[1].setBound(0, 11);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def cs1 = [new Color(255, 0, 0, 128)] * 5 // transparent bars\n", "def cs2 = [new Color(0, 0, 0, 128)] * 5 // transparent bars\n", "def ss = [StrokeType.DASH, StrokeType.DASH, StrokeType.DASH, StrokeType.DASH, StrokeType.DASH]\n", "def y1 = [4, 4, 4, 8, 9]\n", "def y2 = [2, 4, 6, 5, 9]\n", "\n", "def plot = new Plot(title: \"2nd YAxis is zoomed\")\n", "plot << new YAxis(label: \"nd\")\n", "plot << new Line(y: y1)\n", "plot << new Points(y: y1, size: 12.0, shape: ShapeType.CIRCLE)\n", "plot << new Bars(y: y1, color: cs1, width: 0.3)\n", "plot << new Stems(y: [4, 4, 4, 8, 9], width: 2)\n", "plot << new Line(y: y2, yAxis: \"nd\")\n", "plot << new Points(y: y2, size: 5.0, shape: ShapeType.CIRCLE, yAxis: \"nd\")\n", "plot << new Bars(y: y2, color: cs2, width: 0.3, yAxis: \"nd\")\n", "plot << new Stems(y: [2, 4, 6, 5, 9], width: 6, style: ss, yAxis: \"nd\")\n", "plot.getYAxes()[0].setBound(0, 9);\n", "plot.getYAxes()[1].setBound(0, 7);\n", "plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "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" } }, "nbformat": 4, "nbformat_minor": 2 }