Created
          April 21, 2018 01:55 
        
      - 
      
- 
        Save ceptreee/c985d8d886168b48164dc4d3ab317968 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import numpy as np | |
| import matplotlib.pyplot as plt | |
| from matplotlib.colors import LinearSegmentedColormap | |
| clist=[(1,1,1),(1,0,0)] | |
| cm = LinearSegmentedColormap.from_list('wr',clist) | |
| plt.register_cmap(cmap=cm) | |
| clist=[(0,0,1),(1,1,1)] | |
| cm = LinearSegmentedColormap.from_list('bw',clist) | |
| plt.register_cmap(cmap=cm) | |
| h = 0.01 | |
| lm = [-2, 2] | |
| x = np.arange(lm[0],lm[1]+h,h) | |
| y = np.arange(lm[0],lm[1]+h,h) | |
| xx,yy=np.meshgrid(x,y) | |
| zz = xx+yy | |
| plt.close('all') | |
| plt.figure() | |
| plt.subplot(1,3,1) | |
| plt.imshow(zz,cmap='bw') | |
| plt.title('bw') | |
| plt.subplot(1,3,2) | |
| plt.imshow(zz,cmap='bwr') | |
| plt.title('bwr') | |
| plt.subplot(1,3,3) | |
| plt.imshow(zz,cmap='wr') | |
| plt.title('wr') | |
| plt.tight_layout() | |
| plt.savefig('bw_wr.png') | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment