forked from merlimed/Bet_hedging_dormancy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fig3_4_plot_two_heatmaps.m
63 lines (56 loc) · 1.9 KB
/
Fig3_4_plot_two_heatmaps.m
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
% For this figure we plot the two fitness maps we computed
% Fig3_4_compute_two_heatmaps
clc
clear
load 'Data/heatmap_nodelay.mat'
load 'Data/heatmap_onedelay.mat'
load 'Data/parameters.mat'
xy_vals = pars.xy_vals; % all values for x and y
n_val = length(xy_vals); % tick values for x and y
vals_short = linspace(0, 1, 11); % values for x and yticks
%% Define color map
my_c = spring;
my_c(1:150,1) = linspace(.7, 1, 150);
my_c(:,3) = my_c(:,3)./linspace(1.8, 1, 256)';
%% plot
%find max ind
[x0_max, y0_max] = find(L_fin == max(max(L_fin)));
[x1_max, y1_max] = find(L_fin_delay == max(max(L_fin_delay)));
yvals = [1, .95, .9, .85, .8, .75, .7, .65, .6, .55, .5, .45, .4, .35, ...
.3, .25, .2, .15, .1, .05, 0];
yvals_short = [1, .9, .8, .7, .6, .5, .4, .3, .2, .1, 0];
figure('Position', [200 350 930 320])
subplot(1,2,1)
ax1 = gca;
clims = [0, max(max(L_fin))];
imagesc(ax1, flipud(L_fin), clims);
colormap(ax1, my_c)
hold on
plot(y0_max, n_val +1 - x0_max, 'rx', 'LineWidth', 2.5, 'MarkerSize', 12)
set(ax1, 'FontSize', 14)
ax1.XTick = 1 + vals_short * (n_val - 1);
ax1.YTick = 1 + vals_short * (n_val - 1);
ax1.XTickLabels = vals_short;
ax1.YTickLabels = yvals_short;
title('\tau = 2, \kappa = 1', 'FontSize', 16)
xlabel('Initiation x', 'FontSize', 16)
ylabel('Resuscitation y', 'FontSize', 16)
c = colorbar('FontSize',16);
c.Label.String = 'Lyapunov exponent';
subplot(1,2,2)
ax2 = gca;
clims = [0, max(max(L_fin))];
imagesc(ax2, flipud(L_fin_delay), clims);
hold on
plot(y1_max, n_val + 1 - x1_max, 'rx', 'LineWidth', 2.5, 'MarkerSize', 12)
colormap(ax2, my_c)
ax2.XTick = 1 + vals_short * (n_val - 1);
ax2.XTickLabels = vals_short;
ax2.YTick = 1 + vals_short * (n_val - 1);
ax2.YTickLabels = yvals_short;
set(gca, 'FontSize', 14)
title('\tau = 2, \kappa = 1', 'FontSize', 16)
xlabel('Initiation x', 'FontSize', 16)
ylabel('Resuscitation y', 'FontSize', 16)
c = colorbar('FontSize',16);
c.Label.String = 'Lyapunov exponent';