Reverse colormap in matplotlib

前端 未结 7 745
小蘑菇
小蘑菇 2020-11-28 02:04

I would like to know how to simply reverse the color order of a given colormap in order to use it with plot_surface.

相关标签:
7条回答
  • 2020-11-28 03:04

    The solution is pretty straightforward. Suppose you want to use the "autumn" colormap scheme. The standard version:

    cmap = matplotlib.cm.autumn
    

    To reverse the colormap color spectrum, use get_cmap() function and append '_r' to the colormap title like this:

    cmap_reversed = matplotlib.cm.get_cmap('autumn_r')
    
    0 讨论(0)
提交回复
热议问题