From 7ea21ca7656f0d820618c9068a2efa99bbc0655a Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Tue, 9 Apr 2013 15:10:28 +0200 Subject: [PATCH] reporting: @graph: legend uses tex --- matlab/reports/@graph/createGraph.m | 3 ++- matlab/reports/@series/getTexName.m | 23 +++++++++++++++++ matlab/reports/@seriesElements/getTexNames.m | 26 ++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 matlab/reports/@series/getTexName.m create mode 100644 matlab/reports/@seriesElements/getTexNames.m diff --git a/matlab/reports/@graph/createGraph.m b/matlab/reports/@graph/createGraph.m index dd1beedb0..e800416b4 100644 --- a/matlab/reports/@graph/createGraph.m +++ b/matlab/reports/@graph/createGraph.m @@ -98,10 +98,11 @@ set(gca,'XTick', x); set(gca,'XTickLabel', xlabels); if o.legend - lh = legend(o.seriesElements.getNames()); + lh = legend(o.seriesElements.getTexNames()); set(lh, 'orientation', o.legend_orientation); set(lh, 'Location', o.legend_location); set(lh, 'FontSize', o.legend_font_size); + set(lh, 'interpreter', 'latex'); legend('boxoff'); end diff --git a/matlab/reports/@series/getTexName.m b/matlab/reports/@series/getTexName.m new file mode 100644 index 000000000..e79660836 --- /dev/null +++ b/matlab/reports/@series/getTexName.m @@ -0,0 +1,23 @@ +function s = getTexName(o) +%function s = getTexName(o) + +% Copyright (C) 2013 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. + +assert(~isempty(o.data) && size(o.data, 2) == 1); +s = o.data(1).tex(); +end \ No newline at end of file diff --git a/matlab/reports/@seriesElements/getTexNames.m b/matlab/reports/@seriesElements/getTexNames.m new file mode 100644 index 000000000..7c247b926 --- /dev/null +++ b/matlab/reports/@seriesElements/getTexNames.m @@ -0,0 +1,26 @@ +function names = getTexNames(o, varargin) +%function names = getTexNames(o, varargin) + +% Copyright (C) 2013 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. + +se = o.objArray.getObjs(varargin{:}); +names = {}; +for i=1:length(se) + names(i) = se{i}.getTexName(); +end +end \ No newline at end of file -- GitLab