Re: Still trying to draw histograms in VisAD...

Hi Frank...

It looks to me like the rendering of your lines is being done very indirectly, and it looks like the placement of the 'shape' is always fixed at the "visad box" coordinate of y=0 -- Bill will have to comment on that.

Unless you're using this project as a way to learn a lot about VisAD, I might suggest a far simpler approach: use the drawLine() method available in subs.py. (You could, of course, also use the 'graph.histogram()' method, but drawLine() gives you a little more control). I offer this modest example that will draw your histogram-type of display:

from visad.python.JPythonMethods import *
import subs

def main():

  maps = subs.makeMaps("Day", "x", "Precipitation", "y")

  Nday = 31
  maps[0].setRange(0,Nday-1)
  maps[1].setRange(0,1)

  disp = subs.makeDisplay( maps )

  from random import *
  for x in xrange(Nday):
    y = .1 * random()
    if x == 0: y = 1.0
    subs.drawLine(disp, ((x,x),(y,0)), color='green', width=4)

  showAxesScales(disp,1)

  from java.awt import Font
  setAxesScalesFont(maps, Font("Monospaced", Font.PLAIN, 22))

  subs.setBoxSize(disp,.65)
  subs.showDisplay(disp)

if __name__ == "__main__":
    main()



--
Tom Whittaker (tomw@xxxxxxxxxxxxx)
University of Wisconsin-Madison
Space Science and Engineering Center
Cooperative Institute for Meteorological Satellite Studies
Phone/VoiceMail: 608.262.2759


  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: