Beispiel #1
0
def colorimage(red_data,
               green_data,
               blue_data,
               panel=None,
               colortable=None,
               width=400,
               height=400,
               title="VisAD Color Image"):
    """
  Display a color image, from three images <red_data>, <green_data>
  and <blue_data>.  <panel> is the name of a panel to put this into
  (default= make a new one), <colortable> is a color table to use (def
  = gray scale), <width> and <height> are the dimensions.  <title> is
  the phrase for the title bar.  Returns a reference to the display.

  """

    _comb_image = FieldImpl.combine([red_data, green_data, blue_data])
    dom_1 = RealType.getRealType(domainType(_comb_image, 0))
    dom_2 = RealType.getRealType(domainType(_comb_image, 1))
    rng = rangeType(_comb_image)
    maps = subs.makeMaps(dom_1, 'x', dom_2, 'y', rng[0], 'red', rng[1],
                         'green', rng[2], 'blue')

    disp = subs.makeDisplay(maps)
    subs.addData('comb', _comb_image, disp)
    subs.setBoxSize(disp, .80)
    subs.setAspectRatio(disp, float(width) / float(height))
    subs.showDisplay(disp, width, height, title, None, None, panel)
    return disp
Beispiel #2
0
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
Beispiel #3
0
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
Beispiel #4
0
def colorimage(red_data, green_data, blue_data, panel=None, colortable=None, width=400, height=400, title="VisAD Color Image"):
  """
  Display a color image, from three images <red_data>, <green_data>
  and <blue_data>.  <panel> is the name of a panel to put this into
  (default= make a new one), <colortable> is a color table to use (def
  = gray scale), <width> and <height> are the dimensions.  <title> is
  the phrase for the title bar.  Returns a reference to the display.

  """


  _comb_image = FieldImpl.combine( [red_data, green_data, blue_data])
  dom_1 = RealType.getRealType(domainType(_comb_image,0))
  dom_2 = RealType.getRealType(domainType(_comb_image,1))
  rng = rangeType(_comb_image)
  maps = subs.makeMaps(dom_1,'x', dom_2, 'y', rng[0], 'red',
     rng[1], 'green', rng[2], 'blue')

  disp = subs.makeDisplay(maps)
  subs.addData('comb',_comb_image,disp)
  subs.setBoxSize(disp, .80)
  subs.setAspectRatio(disp, float(width)/float(height))
  subs.showDisplay(disp,width,height,title,None,None,panel)
  return disp