From ad2b5fed3e349920ea8709aef20bbf342e7160e3 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/reporting/@graph/createGraph.m | 3 ++- matlab/reporting/@series/getTexName.m | 23 ++++++++++++++++ .../reporting/@seriesElements/getTexNames.m | 26 +++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 matlab/reporting/@series/getTexName.m create mode 100644 matlab/reporting/@seriesElements/getTexNames.m diff --git a/matlab/reporting/@graph/createGraph.m b/matlab/reporting/@graph/createGraph.m index dd1beedb04..e800416b4c 100644 --- a/matlab/reporting/@graph/createGraph.m +++ b/matlab/reporting/@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/reporting/@series/getTexName.m b/matlab/reporting/@series/getTexName.m new file mode 100644 index 0000000000..e796608362 --- /dev/null +++ b/matlab/reporting/@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/reporting/@seriesElements/getTexNames.m b/matlab/reporting/@seriesElements/getTexNames.m new file mode 100644 index 0000000000..7c247b9263 --- /dev/null +++ b/matlab/reporting/@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