Personal tools
You are here: Home CDAT Tips and Tricks 2D Plot Tips Changing axis annotation
Document Actions

Changing axis annotation

by Renata McCoy last modified 2007-05-08 10:37

Goal: Learn about changing axis annotation.


Let's read and plot some example data with default axis annotation

# import necessary module
import cdms,vcs,os,sys

# open the file to read, return "f" - the file object
f = cdms.open(os.path.join(sys.prefix,'sample_data','clt.nc'))

# get a variable 'clt' from the opened file
s = f('clt')
u = f('u')

# initiate vcs
x = vcs.init()

# plot with default tempate settings
g = x.createboxfill('new')
t = x.createtemplate('new','ASD')
d = x.plot(s,g,t)
change the x axis annotation:
# to change x axis annotation, define x axis labels as follows:
g.xticlabels1 = {0:'0',50:'50E',100:'100E',-50:'50W', -100:'100W'}



Powered by Plone