Python Pylab pcolor options for publication quality plots

前端 未结 2 813
孤独总比滥情好
孤独总比滥情好 2021-02-09 18:26

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 colo

相关标签:
2条回答
  • 2021-02-09 18:37

    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.

    0 讨论(0)
  • 2021-02-09 18:51

    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

    0 讨论(0)
提交回复
热议问题