You can change the scaling of axes using the Axes.set_xscale and Axes.set_yscale functions, which both accept either linear, log or symlog as input. So to change a plot to have a log-scaled x axis you would do something like:
import matplotlib.pyplot as plt
ha = plt.subplot(111)
# Plot your spectrogram here...
ha.set_xscale('log')
Edit This seems to be a known issue. There are the commands available to do this but not in any particularly convenient way (it should just be a flag to the specgram function or set_xscale and set_yscale should work). However, there is a way to do this:
Instead of using matplotlib.pyplot.specgram use matplotlib.mlab.specgram. This computes the spectogram but does not draw it. You can then use matplotlib.pyplot.pcolor or a similar function to plot the spectogram. So try something like:
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
# Set up your data here...
Pxx, freq, t = mlab.specgram(x) # Other options, such as NFFT, may be passed
# to `specgram` here.
ha = plt.subplot(111)
ha.pcolor(t, freq, Pxx)
ha.set_xscale('log')