Hi,

another question. Given the plot from my last email (I attached the code
to this one as well), I would like to have the x-labels ("J", "F", ...)
not at the location of the xticks, but centered in between to xticks. I
would then move the xticks so that they form the bins to the data chunks,
and the labels should be where the current xticks are.

Any suggestions are again extremely welcome :)

Cheers, Andreas.
from numpy import arange, linspace, where, searchsorted, zeros, nan, loadtxt, asarray, random
from numpy.ma import masked_invalid
import matplotlib.pyplot as plt

data = random.randn(12,72)

nxbin, nybin = data.shape
xbin = linspace(0, 12, nxbin + 1)
ybin = linspace(-90, 90, nybin + 1)
pdata = masked_invalid(data)

fig = plt.figure()
spl = fig.add_subplot(111)

cmap = mpl.cm.seismic
cmap.set_bad('#cccccc', 1.)

pl = spl.pcolormesh(xbin, ybin, pdata.T,
        cmap=cmap, edgecolors='None',
        vmin=-7,vmax=7,
        )
spl.axis([0., 12., ybin.min(), ybin.max()])

spl.set_xticks(xbin[1:]-.5)
spl.set_xticklabels(['J','F','M','A','M','J','J','A','S','O','N','D'],
        size='large')
spl.set_xlim([0.,12.])
spl.set_xlabel(u'Month', size='x-large', fontname='Arial')

spl.set_ylabel(u'Latitude [°]', size='x-large', fontname='Arial')
spl.set_yticks(linspace(-90., 90., 7))
spl.set_yticklabels(arange(-90,91,30), size='large', fontname='Arial')

cb = plt.colorbar(mappable=pl, orientation='horizontal',
                  fraction=0.075, aspect=50, pad=.15)
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to