def lineplot(data, panel=None, color=None, width=400, height=400, title="Line Plot"): """ Quick plot of a line plot from <data>. <panel> is the name of a panel to put this into (default= make a new one), <color> is the color to use, <width> and <height> are the dimensions, <title> is the phrase for the title bar. Returns a reference to the display. """ if isinstance(data,PyTuple) or isinstance(data,PyList): data = field(data) domt = domainType(data) rngt = rangeType(data) xaxis = ScalarMap(domt[0], Display.XAxis) if isinstance(rngt,RealTupleType): yaxis = ScalarMap(rngt[0], Display.YAxis) else: yaxis = ScalarMap(rngt, Display.YAxis) axes = (xaxis, yaxis) disp = subs.makeDisplay( axes ) constmap = subs.makeColorMap(color) dr=subs.addData("Lineplot", data, disp, constmap) subs.setBoxSize(disp, .70) showAxesScales(disp, 1) setAxesScalesFont(axes, Font("Monospaced", Font.PLAIN, 18)) subs.setAspectRatio(disp, float(width)/float(height)) subs.showDisplay(disp,width,height,title,None,None,panel) return disp
def scatter(data_1, data_2, panel=None, pointsize=None, width=400, height=400, xlabel=None, ylabel=None, title="VisAD Scatter", bottom=None, top=None, color=None): """ Quick plot of a scatter diagram between <data_1> and <data_2>. <panel> is the name of a panel to put this into (default= make a new one), <pointsize> is the size of the scatter points (def = 1), <width> and <height> are the dimensions, <xlabel> and <ylabel> are the axes labels to use (def = names of data objects). <title> is the phrase for the title bar. Returns a reference to the display. """ if isinstance(data_1,PyList) or isinstance(data_1,PyTuple): data_1 = field('data_1',data_1) if isinstance(data_2,PyList) or isinstance(data_2,PyTuple): data_2 = field('data_2',data_2) rng_1 = data_1.getType().getRange().toString() rng_2 = data_2.getType().getRange().toString() data = FieldImpl.combine((data_1,data_2)) maps = subs.makeMaps(getRealType(rng_1),"x", getRealType(rng_2),"y") disp = subs.makeDisplay(maps) subs.addData("data", data, disp, constantMaps=subs.makeColorMap(color)) subs.setBoxSize(disp, .70) showAxesScales(disp,1) #setAxesScalesFont(maps, Font("Monospaced", Font.PLAIN, 18)) if pointsize is not None: subs.setPointSize(disp, pointsize) subs.setAspectRatio(disp, float(width)/float(height)) subs.showDisplay(disp,width,height,title,bottom,top,panel) setAxesScalesLabel(maps, [xlabel, ylabel]) return disp
def scatter(data_1, data_2, panel=None, pointsize=None, width=400, height=400, xlabel=None, ylabel=None, title="VisAD Scatter", bottom=None, top=None, color=None): """ Quick plot of a scatter diagram between <data_1> and <data_2>. <panel> is the name of a panel to put this into (default= make a new one), <pointsize> is the size of the scatter points (def = 1), <width> and <height> are the dimensions, <xlabel> and <ylabel> are the axes labels to use (def = names of data objects). <title> is the phrase for the title bar. Returns a reference to the display. """ if isinstance(data_1, PyList) or isinstance(data_1, PyTuple): data_1 = field('data_1', data_1) if isinstance(data_2, PyList) or isinstance(data_2, PyTuple): data_2 = field('data_2', data_2) rng_1 = data_1.getType().getRange().toString() rng_2 = data_2.getType().getRange().toString() data = FieldImpl.combine((data_1, data_2)) maps = subs.makeMaps(getRealType(rng_1), "x", getRealType(rng_2), "y") disp = subs.makeDisplay(maps) subs.addData("data", data, disp, constantMaps=subs.makeColorMap(color)) subs.setBoxSize(disp, .70) showAxesScales(disp, 1) #setAxesScalesFont(maps, Font("Monospaced", Font.PLAIN, 18)) if pointsize is not None: subs.setPointSize(disp, pointsize) subs.setAspectRatio(disp, float(width) / float(height)) subs.showDisplay(disp, width, height, title, bottom, top, panel) setAxesScalesLabel(maps, [xlabel, ylabel]) return disp
def lineplot(data, panel=None, color=None, width=400, height=400, title="Line Plot"): """ Quick plot of a line plot from <data>. <panel> is the name of a panel to put this into (default= make a new one), <color> is the color to use, <width> and <height> are the dimensions, <title> is the phrase for the title bar. Returns a reference to the display. """ if isinstance(data, PyTuple) or isinstance(data, PyList): data = field(data) domt = domainType(data) rngt = rangeType(data) xaxis = ScalarMap(domt[0], Display.XAxis) if isinstance(rngt, RealTupleType): yaxis = ScalarMap(rngt[0], Display.YAxis) else: yaxis = ScalarMap(rngt, Display.YAxis) axes = (xaxis, yaxis) disp = subs.makeDisplay(axes) constmap = subs.makeColorMap(color) dr = subs.addData("Lineplot", data, disp, constmap) subs.setBoxSize(disp, .70) showAxesScales(disp, 1) setAxesScalesFont(axes, Font("Monospaced", Font.PLAIN, 18)) subs.setAspectRatio(disp, float(width) / float(height)) subs.showDisplay(disp, width, height, title, None, None, panel) return disp