-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhex_plot.m
More file actions
43 lines (23 loc) · 746 Bytes
/
hex_plot.m
File metadata and controls
43 lines (23 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function ax = hex_plot(data,nrows,ax)
% TCS 10/24/14 - for plotting channel responses, weights, etc in hex grid
% TODO: add support for custom color limits, rotating points, etc
if nargin < 3
figure;
ax = axes;
end
ax.Color = [0.5 0.5 0.5];
hold on;
[xGrid, yGrid] = make_hex(nrows);
marker_size = 2/(2*nrows);
chan_range = [min(data) max(data)];
n_colors = 1000;
cmap = viridis(n_colors+1); % or parula...
xx = cos(linspace(0,2*pi,501))*marker_size;
yy = sin(linspace(0,2*pi,501))*marker_size;
for ii = 1:length(data)
this_c = cmap(1+floor((data(ii)-chan_range(1))/(chan_range(2)-chan_range(1))*n_colors),:);
patch(xx+xGrid(ii),yy+yGrid(ii),this_c);
clear this_c;
end
axis equal
return