decadal_feedback_variations_plot_differences.m 1.96 KB
Newer Older
Claas Faber's avatar
Claas Faber committed
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 64 65 66 67 68 69 70 71 72 73
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                           %
%    DIAGNOSE DECADAL FEEDBACK VARIATIONS   %
%    PLOTS                                  %
%                                           %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

disp('plotting feedback strength differences');

% SET UP FIGURE
% +++++++++++++

    hf  = figure;
    hf.Position(3) = scale_figure_width*hf.Position(3);
    hf.Position(4) = scale_figure_height*hf.Position(4);

    % axes
    hax = axes('XLim',[all_starts(1) all_starts(end)],'YLim',[0.5 12.5],...
            'YTick',1:12,'YTickLabel',{month_ids{:}},...
            'XGrid','on','Layer','top');

    font_size    = floor(hax.FontSize*scale_font_size);
    hax.FontSize = font_size;

    hold(hax,'on');

    % naming the regions
    x_ticks        = [];
    x_tick_labels  = {};

% SET NEGATIVE LAGS TO NAN
% ++++++++++++++++++++++++

    is_negative_lag = ( lag_variations < 0 );
    use_data        = feedback_strengths.positive-feedback_strengths.negative;

    % correct dimensions
    if ( size(is_negative_lag,1) ~= 12 )
        is_negative_lag = is_negative_lag';
    end

    % pick correct feedback strengts and set negative lags to NaN
    use_data(is_negative_lag) = 0;

% PLOT DATA
% +++++++++

    % checkerboard, as in the dynamics analysis
    image(all_starts,[1:12],use_data,'CDataMapping','scaled');
    colorbar(hax);

% POLISHING AND PRINTING
% ++++++++++++++++++++++

    xlabel(hax,'Start year');
    ylabel(hax,'Month');

    % title
    fig_title = strrep(title_dummy,'@ANOMALYTYPE@',basin_name);
    title(hax,fig_title);

    % align axes
    hax.Position = axes_position;

    % colormap and number of displayed colours
    hax.CLim = [-all_diff_limits.(ref_name) all_diff_limits.(ref_name)];
    % diff_cmap = centered(n_colours);
    colormap(centered_cmap);

    % print
    fig_name = strrep(name_dummy,'@ANOMALYTYPE@','differences');
    print(hf,res_flag,fig_name,'-dpng');
    close(hf);