setting axis limits for contour plots

From: Juerg Schmidli <schmidli_at_nyahnyahspammersnyahnyah>
Date: Tue, 21 Nov 2006 00:02:13 -0800

Hi all

I have a problem setting the axis limits with contour plots. I want
to compare, for instance, time-height plots of wind speed from
observations with simulation results, where the observations are
not complete. Say for example, that the observations are only available
for the first 12 hours, but that I want to create a plot covering the
entire day.

I tried to set the resources trXMinF, trXMaxF, trYMinF, trYMaxF to
the corresponding values, but I get the message
"warning:ContourPlotInitialize: current transformation requires trYMinF
to be within data coordinate range: resetting"

I included a short test script to illustrate the problem.

How can I set the plotting window to a region which is larger than
that covered by the data?

Any help is greatly appreciated


#!/usr/bin/env python

# trGridType: Map, LogLin, Irregular, Curvilinear, Spherical, TriangularMesh,
# nglXAxisType: this resource allows you to convert an irregular X axis
# to a linear or log axis;
# "IrregularAxis", "LinearAxis" and "LogAxis"

from numpy import *
import PyNGL_numpy.Ngl as Ngl

t = arange(10)+10
z = arange(10)+0.5
fld = zeros((10,10))
fld[:,:] = sin(t)[:,newaxis]*cos(z)[newaxis,:]

wks = Ngl.open_wks('x11', 'test')

# Example 1:
# no errors and no warnings

res = Ngl.Resources()
res.cnFillOn = True
res.sfXArray = t
res.sfYArray = z
cplot = Ngl.contour(wks, fld, res)

# Example 2:
# warning:ContourPlotInitialize: current transformation requires trYMinF to be within data coordinate range: resetting

res.cnFillOn = False
#res.trGridType = 'CurviLinear'
#res.trGridType = 'TriangularMesh'
res.trYMinF = 0
res.trYMaxF = 9
cplot = Ngl.contour(wks, fld, res)

# Example 3:
res.cnFillOn = True
res.trXMaxF = 20
cplot = Ngl.contour(wks, fld, res)

pyngl-talk mailing list
Received on Tue Nov 21 2006 - 01:02:13 MST

This archive was generated by hypermail 2.2.0 : Tue Nov 28 2006 - 15:20:02 MST