In [1]:
def plot = new Plot(title: "Setting 2nd Axis bounds")
def ys = [0, 2, 4, 6, 15, 10]
def ys2 = [-40, 50, 6, 4, 2, 0]
def ys3 = [3, 6, 3, 6, 70, 6]
plot << new YAxis(label:"Spread")
plot << new Line(y: ys)
plot << new Line(y: ys2, yAxis: "Spread")
//plot << new Line(y: ys3, yAxis: "Spread")
//plot.getYAxes()[0].setBound(1,5);
//plot.getYAxes()[1].setBound(3,6) // this should change the bounds of the 2nd, right axis
plot
In [2]:
def plot = new CategoryPlot()
def cs = [new Color(255, 0, 0, 128)] * 5 // transparent bars
def cs1 = [new Color(0, 0, 0, 128)] * 5 // transparent bars
plot << new YAxis(label:"nd")
plot << new CategoryBars(value: [[1, 2, 3], [1, 3, 5]], color: cs)
plot << new CategoryBars(value: [[4, 4, 4], [6,7, 8]], color: cs1, yAxis: "nd")
plot.getYAxes()[0].setBound(0,5)
plot.getYAxes()[1].setBound(-20,20) // this should change the bounds of the 2nd, right axis
plot
Out[2]:

In [3]:
def plot = new Plot();
def y1 = [1.5, 1, 6, 5, 2, 8]
def y2 = [10, 10, 60, 50, 20, 50]
plot << new YAxis(label:"nd")
def cs = [Color.black, Color.red, Color.gray, Color.green, Color.blue, Color.pink]
def ss = [StrokeType.SOLID, StrokeType.SOLID, StrokeType.DASH, StrokeType.DOT, StrokeType.DASHDOT, StrokeType.LONGDASH]
plot.getYAxes()[1].setBound(0,20)
plot << new Stems(y: y2, color: cs, width: 2)
plot << new Stems(y: y1, color: cs, style: ss, width: 6, yAxis: "nd")
Out[3]:

In [4]:
def plot = new Plot(title: "Bars")
def cs = [new Color(255, 0, 0, 128)] * 5 // transparent bars
def cs1 = [new Color(0, 0, 0, 128)] * 5 // transparent bars
plot << new YAxis(label:"nd")
cs[3] = Color.red // set color of a single bar, solid colored bar
plot << new Bars(x: (1..5), y: [3, 6, 5, 99, 8], color: cs, outlineColor: Color.black, width: 0.3)
plot << new Bars(x: (1..5), y: [1, 2, 3, 4, 11], color: cs1, outlineColor: Color.black, width: 0.3, yAxis: "nd")
//plot.getYAxes()[1].setBound(0,5)
plot
Out[4]:

In [5]:
def plot = new Plot(title: "Changing Point Size, Color, Shape")
def y1 = [6, 7, 12, 11, 8, 14]
def y2 = y1.collect { it - 2 }
def y3 = y2.collect { it - 2 }
def y4 = y3.collect { it - 2 }
plot << new YAxis(label:"nd")
plot << new Points(y: y1)
plot << new Points(y: y2, shape: ShapeType.CIRCLE, yAxis: "nd")
plot << new Points(y: y3, size: 8.0, shape: ShapeType.DIAMOND)
plot << new Points(y: y4, size: 12.0, color: Color.orange, outlineColor: Color.red)
plot.getYAxes()[1].setBound(5,10)
plot
Out[5]:

In [6]:
def p = new Plot()
p << new YAxis(label:"nd")
p << new Line(y: [3, 6, 12, 24], displayName: "Median")
p << new Area(y: [4, 8, 16, 32], base: [2, 4, 8, 16],
              color: new Color(255, 0, 0, 50), displayName: "Q1 to Q3", yAxis: "nd")
p.getYAxes()[1].setBound(0,100)
p
Out[6]:

In [ ]: