diff --git a/doc/dynare.texi b/doc/dynare.texi index ec7ab1a24..765530403 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -11189,6 +11189,7 @@ The height of the graph, in inches. Default: @code{4.5} Whether or not to display the major grid on the graph. Default: @code{true} +@anchor{showLegend} @item showLegend, @code{BOOLEAN} Whether or not to display the legend. Default: @code{false} @@ -11331,7 +11332,7 @@ Whether or not to show vertical lines separating the columns. Default: @code{fal @end defmethod @anchor{addSeries} -@defmethod Report addSeries data, graphLineColor, graphLineStyle, graphLineWidth, graphMarker, graphMarkerEdgeColor, graphMarkerFaceColor, graphMarkerSize, tableDataRhs, tableRowColor, tableRowIndent, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, tableSubSectionHeader, zeroTol +@defmethod Report addSeries data, graphLegendName, graphLineColor, graphLineStyle, graphLineWidth, graphMarker, graphMarkerEdgeColor, graphMarkerFaceColor, graphMarkerSize, tableDataRhs, tableRowColor, tableRowIndent, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, tableSubSectionHeader, zeroTol Adds a @code{Series} to a @code{Graph} or a @code{Table}. @optionshead @table @code @@ -11339,6 +11340,10 @@ Adds a @code{Series} to a @code{Graph} or a @code{Table}. @item data, @code{dseries} @xref{data}. +@item graphLegendName, @code{STRING} +The name to display in the legend for this series. Will be displayed only if +the @ref{data} option has been set. Default: the @code{tex} name of the series + @item graphLineColor, @code{`red'} | @code{`green'} | @code{`blue'} | @code{`cyan'} | @code{`magenta'} | @code{`yellow'} | @code{`black'} | @code{`gray'} | @code{`darkgray'} | @code{`lightgray'} | @code{`brown'} | @code{`lime'} | @code{`olive'} | @code{`orange'} | @code{`pink'} | @code{`purple'} | @code{`teal'} | @code{`violet'} | @code{`white'} Color to use for the series in a graph. Default: @code{`black'} diff --git a/matlab/reports/@report_series/report_series.m b/matlab/reports/@report_series/report_series.m index 41d6286b0..4adf75409 100644 --- a/matlab/reports/@report_series/report_series.m +++ b/matlab/reports/@report_series/report_series.m @@ -35,6 +35,8 @@ o = struct; o.data = ''; +o.graphLegendName = ''; + o.graphLineColor = 'black'; o.graphLineStyle = 'solid'; o.graphLineWidth = 0.5; @@ -84,6 +86,10 @@ elseif nargin > 1 end end +if ~isempty(o.graphLegendName) + o.data = o.data.tex_rename(o.graphLegendName); +end + % Create report_series object o = class(o, 'report_series'); end \ No newline at end of file diff --git a/tests/reporting/runDynareReport.m b/tests/reporting/runDynareReport.m index 5a08c73d6..afdff0447 100644 --- a/tests/reporting/runDynareReport.m +++ b/tests/reporting/runDynareReport.m @@ -239,11 +239,13 @@ rep = rep.addGraph('title', 'Equilibrium World Real Food Price', ... 'xTickLabelRotation', 0); rep = rep.addSeries('data', db_q{'LRPFOOD_BAR_WORLD'}, ... 'graphLineColor', 'blue', ... - 'graphLineWidth', 1.5); + 'graphLineWidth', 1.5, ... + 'graphLegendName', 'baseline'); rep = rep.addSeries('data', dc_q{'LRPFOOD_BAR_WORLD'}, ... 'graphLineColor', 'blue', ... 'graphLineStyle', 'dashed', ... - 'graphLineWidth', 1.5); + 'graphLineWidth', 1.5, ... + 'graphLegendName', 'control'); %% Write & Compile Report rep.write();