"""
    interactive mode and using pylab.contour (ax.contour + pylab.draw)
    is needed for proper values in ax.get_xticklabels()

    -> Why?
"""

from pylab import *

ion()                                 # interactive mode
figure()
ax = axes()

x = 10**arange(6.0)                   # generating some data
x, y = meshgrid(x, x)
z = log10(x**2 + y**3)

contour(log10(x), log10(y), z)

### long version :
##new_xticklabels = []                # list of strings as new tick labels
##for txt in ax.get_xticklabels():
##    # append new string as ticklabel : (some appropriate formatting is needed)
##    print r'10^'+txt.get_text()
##    new_xticklabels.append(r'10^'+txt.get_text())
##ax.set_xticklabels(new_xticklabels)

# short version (with list comprehension):
ax.set_xticklabels([r'10^'+txt.get_text() for txt in ax.get_xticklabels()])

draw()                                # needed to actually use new values
                                      # Why?
ioff()
show()
