alternate axes labels in VisAD-Python

Recently I received an email with the question about how to produce different labels on the axes of VisAD graphs. Unfortunately, the return address was invalid, so I'm answering the question here.

This is provided through AxisScale's setLabelTable() method. You must consctruct a java.util.Hashtable, and put() entries in the form:

ht.put(new Double(0),"zero")
ht.put(new Double(10),"ten")

In Jython, you would need to do pretty much the same thing. Here is the example you asked for:

from java.util import Hashtable
from java.lang import Double
from visad import AxisScale
from subs import *
a=load("AREA0001")
m=makeMaps("ImageElement",'x',"ImageLine",'y')
d=makeDisplay(m)
ht=Hashtable()
ht.put(Double(0),"zero")
ht.put(Double(350),"3-5-0")
ht.put(Double(700),'7-0-0')
m[0].getAxisScale().setLabelTable(ht)
addData('a',a,d)
showDisplay(d)
showAxesScales(d,1)

Hope that helps.

tom

--
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: