Set Colorbar Range in matplotlib

后端 未结 4 670
心在旅途
心在旅途 2020-11-22 16:24

I have the following code:

import matplotlib.pyplot as plt

cdict = {
  \'red\'  :  ( (0.0, 0.25, .25), (0.02, .59, .59), (1., 1., 1.)),
  \'green\':  ( (0.0         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 16:54

    Use the CLIM function (equivalent to CAXIS function in MATLAB):

    plt.pcolor(X, Y, v, cmap=cm)
    plt.clim(-4,4)  # identical to caxis([-4,4]) in MATLAB
    plt.show()
    

提交回复
热议问题