From a8c9f2afdd94aee679a2720eefb5e68cd4bbcec2 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Thu, 25 Apr 2013 16:55:08 +0200 Subject: [PATCH] reporting: @graph: add option shade_opacity --- matlab/reporting/@graph/createGraph.m | 2 +- matlab/reporting/@graph/graph.m | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/matlab/reporting/@graph/createGraph.m b/matlab/reporting/@graph/createGraph.m index e3ca66c485..22391ed0f7 100644 --- a/matlab/reporting/@graph/createGraph.m +++ b/matlab/reporting/@graph/createGraph.m @@ -88,7 +88,7 @@ if ~isempty(o.shade) % use patch bc area doesn't work with matlab2tikz sh = patch([repmat(x1, 1, 2) repmat(x2, 1, 2)], ... [yrange fliplr(yrange)], [0 1 0], ... - 'FaceAlpha', .2); + 'facealpha', o.shade_opacity); children =get(gca(), 'children'); children = [children(2:end); sh]; set(gca(), 'children', children); diff --git a/matlab/reporting/@graph/graph.m b/matlab/reporting/@graph/graph.m index 94b174eb5e..5f933dade6 100644 --- a/matlab/reporting/@graph/graph.m +++ b/matlab/reporting/@graph/graph.m @@ -45,10 +45,12 @@ o.footnote = ''; o.figname = ''; o.data = ''; o.seriestouse = ''; -o.shade = ''; o.xrange = ''; o.yrange = ''; +o.shade = ''; +o.shade_opacity = .2; + o.grid = true; o.legend = false; @@ -95,6 +97,9 @@ assert(islogical(o.legend), '@graph.graph: legend must be either true or false') assert(islogical(o.legend_boxoff), '@graph.graph: legend_boxoff must be either true or false'); assert(isint(o.legend_font_size), '@graph.graph: legend_font_size must be an integer'); assert(islogical(o.zeroline), '@graph.graph: zeroline must be either true or false'); +assert(isfloat(o.shade_opacity) && length(o.shade_opacity)==1 && ... + o.shade_opacity >= 0 && o.shade_opacity <= 1, ... + '@graph.graph: o.shade_opacity must be a real in [0 1]']); valid_legend_locations = ... {'North', 'South', 'East', 'West', ... 'NorthEast', 'SouthEast', 'NorthWest', 'SouthWest', ... -- GitLab