diff --git a/doc/dynare.texi b/doc/dynare.texi index 34f8a5585..513bbe5b4 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -10352,7 +10352,7 @@ command. Default: @code{`!'} @end table @end defmethod -@defmethod Report addGraph data, figname, figDirName, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, xTickLabels, yrange, showZeroline +@defmethod Report addGraph data, figname, figDirName, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, xTicks, xTickLabels, yrange, showZeroline Adds a @code{Graph} to a @code{Section}. @optionshead @table @code @@ -10425,9 +10425,16 @@ The y-axis label. Default: @code{none} @item xrange, @code{dates} The boundary on the x-axis to display in the graph. Default: all +@anchor{xTicks} +@item xTicks, @code{NUMERICAL_VECTOR} +Used only in conjunction with @ref{xTickLabels}, this option denotes +the numerical position of the label along the x-axis. The positions +begin at @math{1}. Default: set by Matlab/Octave. + +@anchor{xTickLabels} @item xTickLabels, @code{CELL_ARRAY_STRINGS} -The labels to use for the xticks in the graph. Default: the dates of -the @code{dseries} +The labels to be mapped to the ticks provided by +@ref{xTicks}. Default: the dates of the @code{dseries} @item yrange, @code{NUMERICAL_VECTOR} The boundary on the y-axis to display in the graph, represented as a diff --git a/matlab/reports/@graph/createGraph.m b/matlab/reports/@graph/createGraph.m index 49ce04f8d..99d975335 100644 --- a/matlab/reports/@graph/createGraph.m +++ b/matlab/reports/@graph/createGraph.m @@ -110,6 +110,7 @@ if isempty(o.xTickLabels) end end else + set(gca, 'XTick', o.xTicks); xTickLabels = o.xTickLabels; end set(gca, 'XTickLabel', xTickLabels); diff --git a/matlab/reports/@graph/graph.m b/matlab/reports/@graph/graph.m index 812d98992..fbfedda23 100644 --- a/matlab/reports/@graph/graph.m +++ b/matlab/reports/@graph/graph.m @@ -61,6 +61,7 @@ o.legendFontSize = 8; o.showZeroline = false; o.graphSize = []; +o.xTicks = []; o.xTickLabels = {}; if nargin == 1 @@ -135,6 +136,8 @@ assert(isempty(o.seriesToUse) || iscellstr(o.seriesToUse), ['@graph.graph: ' ... assert(isempty(o.graphSize) || ((isfloat(o.graphSize) && length(o.graphSize) == 2)),... ['@graph.graph: graphSize is specified as an array with two float ' ... 'entries, [width height]']); +assert(isempty(o.xTicks) || isfloat(o.xTicks),... + '@graph.graph: xTicks must be a numerical array'); assert(iscellstr(o.xTickLabels), ... '@graph.graph: xTickLabels must be a cell array of strings'); % using o.seriesToUse, create series objects and put them in o.seriesElements