Skip to content

Commit

Permalink
Merge branch 'colormap'
Browse files Browse the repository at this point in the history
  • Loading branch information
szapp committed Oct 17, 2018
2 parents 6fc3343 + fa53e08 commit 0939a86
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
12 changes: 6 additions & 6 deletions checkersvdsurround.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ def mahalonobis_convert(Z, pars):
vmax = np.max(np.abs([sp1, sp2]))
vmin = -vmax
plt.subplot(131)
plt.imshow(sp1, cmap='RdBu', vmin=vmin, vmax=vmax)
plt.imshow(sp1, cmap=iof.config('colormap'), vmin=vmin, vmax=vmax)
plt.subplot(132)
plt.imshow(sp2, cmap='RdBu', vmin=vmin, vmax=vmax)
plt.imshow(sp2, cmap=iof.config('colormap'), vmin=vmin, vmax=vmax)
plt.subplot(133)
im = plt.imshow(fit_frame, cmap='RdBu', vmin=vmin, vmax=vmax)
im = plt.imshow(fit_frame, cmap=iof.config('colormap'), vmin=vmin, vmax=vmax)
plf.colorbar(im, size='2%', ticks=[vmin, vmax], format='%.2f')
plt.show()

Expand All @@ -86,11 +86,11 @@ def mahalonobis_convert(Z, pars):
vmax = np.max(np.abs([sp1c, sp2c]))
vmin = -vmax
plt.subplot(131)
plt.imshow(sp1c, cmap='RdBu', vmin=vmin, vmax=vmax)
plt.imshow(sp1c, cmap=iof.config('colormap'), vmin=vmin, vmax=vmax)
plt.subplot(132)
plt.imshow(sp2c, cmap='RdBu', vmin=vmin, vmax=vmax)
plt.imshow(sp2c, cmap=iof.config('colormap'), vmin=vmin, vmax=vmax)
plt.subplot(133)
im = plt.imshow(fit_framec, cmap='RdBu', vmin=vmin, vmax=vmax)
im = plt.imshow(fit_framec, cmap=iof.config('colormap'), vmin=vmin, vmax=vmax)
plf.colorbar(im, size='2%', ticks=[vmin, vmax], format='%.2f')
plt.show()

Expand Down
5 changes: 3 additions & 2 deletions modules/plotfuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import iofuncs as iof


def spineless(axes, which='trlb'):
Expand Down Expand Up @@ -253,7 +254,7 @@ def stashow(sta, ax=None, cbar=True, **kwargs):
imshow
extent: Change the labels of the axes. [xmin, xmax, ymin, ymax]
aspect: Aspect ratio of the image. 'auto', 'equal'
cmap: Colormap to be used. Default is 'RdBu'
cmap: Colormap to be used. Default is set in config
colorbar
size: Width of the colorbar as percentage of image dimension
Default is 2%
Expand All @@ -267,7 +268,7 @@ def stashow(sta, ax=None, cbar=True, **kwargs):
vmin = -vmax

# Make a dictionary for imshow and colorbar kwargs
imshowkw = {'cmap':'RdBu', 'vmin':vmin, 'vmax':vmax}
imshowkw = {'cmap': iof.config('colormap'), 'vmin':vmin, 'vmax':vmax}
cbarkw = {'size':'2%', 'ticks':[vmin, vmax], 'format':'%.2f'}
for key in kwargs.keys():
if key in ['extent', 'aspect', 'cmap']:
Expand Down
2 changes: 1 addition & 1 deletion plot_checker_stas.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def plot_checker_stas(exp_name, stim_nr, filename=None):
for i in range(filter_length):
ax = plt.subplot(subplot_arr[0], subplot_arr[1], i+1)
im = ax.imshow(a[:, :, i], vmin=sta_min, vmax=sta_max,
cmap='RdBu')
cmap=iof.config('colormap'))
ax.set_aspect('equal')
plt.axis('off')
if i == 0:
Expand Down
2 changes: 1 addition & 1 deletion plotcheckersvd.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def plotcheckersvd(expname, stimnr, filename=None):
for j in range(len(plotthese)):
ax = plt.subplot(rows, cols, j+1)
im = plt.imshow(plotthese[j], vmin=vmin, vmax=vmax,
cmap='RdBu')
cmap=iof.config('colormap'))
ax.set_aspect('equal')
plt.xticks([])
plt.yticks([])
Expand Down
5 changes: 4 additions & 1 deletion pymer_config_default.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
// Search and replace pairs for paths in stimulus files,
// typically used for image or movie files on network e.g.
// "Y:\FromPeopleToPeople\Dimos\natural_stimuli": "~/natural_stimuli"
"stimuli_path_replace": {}
"stimuli_path_replace": {},

// Common colormap for figures
"colormap": "seismic"
}

0 comments on commit 0939a86

Please sign in to comment.