Skip to content Skip to sidebar Skip to footer

Python Pylab Pcolor Options For Publication Quality Plots

I am trying to make DFT (discrete fourier transforms) plots using pcolor in python. I have previously been using Mathematica 8.0 to do this but I find that the colorbar in mathemat

Solution 1:

The following will get you closer to what you want:

import matplotlib.pyplot as plt

plt.pcolor(data, cmap=plt.cm.OrRd)
plt.yticks(np.arange(0.5,10.5),range(0,10))
plt.xticks(np.arange(0.5,10.5),range(0,10))
plt.colorbar()
plt.gca().invert_yaxis()
plt.gca().set_aspect('equal')
plt.show()

The list of available colormaps by default is here. You'll need one that starts out white.

enter image description here

If none of those suits your needs, you can try generating your own, start by looking at LinearSegmentedColormap.

Solution 2:

Just for the record, in Mathematica 9.0:

GraphicsGrid@{{MatrixPlot[l, 
    ColorFunction -> (ColorData["TemperatureMap"][Rescale[#, {Min@l, Max@l}]] &), 
    ColorFunctionScaling -> False], BarLegend[{"TemperatureMap", {0, Max@l}}]}}

enter image description here

Post a Comment for "Python Pylab Pcolor Options For Publication Quality Plots"