Skip to content

Commit

Permalink
ENH - allow for configurable colormap
Browse files Browse the repository at this point in the history
  • Loading branch information
schoffelen committed Nov 22, 2019
1 parent 0bbaa75 commit 4b3f7de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
3 changes: 3 additions & 0 deletions ft_sourceplot_interactive.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ function ft_sourceplot_interactive(cfg, varargin)
[cfg.atlas, varargin{:}] = handle_atlas_input(cfg.atlas, varargin{:});
end

% allow for a user specified colormap of the non-diff surfaces
cfg.colormap = ft_getopt(cfg, 'colormap');

% other defaults are set in the lower-level object

% fetch the functional data
Expand Down
19 changes: 12 additions & 7 deletions plotting/ft_plot_mesh_interactive.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

properties
% data properties
tri; pos; time; data; unit;
tri; pos; time; data; unit;

% configuration options
time_label; pow_label; data_labels; has_diff; clim;

% not yet configurable
timeplot_colourmap;
timeplot_colourmap; colourmap;

% graphics handles
fig_surface; axes_surface; surfs_surface; camlight_surface;
Expand Down Expand Up @@ -59,7 +59,8 @@
% has_diff: treat the last input argument as special, and assign
% different colour limits for the corresponding surface plot
self.has_diff = ft_getopt(varargin, 'has_diff', false);
self.atlas = ft_getopt(varargin, 'atlas');
self.atlas = ft_getopt(varargin, 'atlas');
self.colourmap = ft_getopt(varargin, 'colormap');

if isempty(self.clim)
if self.has_diff
Expand All @@ -68,7 +69,12 @@
self.clim = [0 max(cellfun(@(x) max(x(:)), self.data))*0.75];
end
end


% we need brewermap
ft_hastoolbox('brewermap', 1);
if isempty(self.colourmap)
self.colourmap = brewermap(64, 'YlOrRd');
end
self.axes_surface = [];
self.surfs_surface = [];
self.figs_time = [];
Expand All @@ -82,8 +88,7 @@
% an index into the "current" time point (in seconds)
self.cur_time = 0;

% we need brewermap
ft_hastoolbox('brewermap', 1);


self.timeplot_colourmap = brewermap(8, 'Set2');
end
Expand All @@ -103,7 +108,7 @@ function init_surface_plots(self)
% INIT_SURFACE_PLOTS initializes a single figure that displays
% surface plots for all the functional data at a single time point.
self.fig_surface = figure('Color', 'w');
colormap(self.fig_surface, brewermap(64, 'YlOrRd'));
colormap(self.fig_surface, self.colourmap);
for k = 1:self.ncond
% initialize axes and surface
self.axes_surface(k) = subtightplot(1, numel(self.data), k);
Expand Down

0 comments on commit 4b3f7de

Please sign in to comment.