reporting: @graph: add new option graphSize

time-shift
Houtan Bastani 2013-07-22 12:41:41 -04:00
parent 2955232780
commit a961069a66
3 changed files with 18 additions and 2 deletions

View File

@ -8240,7 +8240,7 @@ command. Default: @code{`!'}
@end table @end table
@end defmethod @end defmethod
@defmethod Report addGraph data, figname, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, yrange, showZeroline @defmethod Report addGraph data, figname, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, yrange, showZeroline
Adds a @code{Graph} to a @code{Section}. Adds a @code{Graph} to a @code{Section}.
@optionshead @optionshead
@table @code @table @code
@ -8253,6 +8253,12 @@ The @code{dynSeries} that provides the data for the graph. Default:
The name to use when saving this figure. Default: @code{[tempname The name to use when saving this figure. Default: @code{[tempname
`.tex']} `.tex']}
@item graphSize, @code{NUMERICAL_VECTOR}
The width and height to be passed to the third and fourth elements of
the array passed to the @code{`Position'} option of Matlab's
@code{figure} command, passed as a vector of size @math{2}. Default:
Matlab sets width and height
@item showGrid, @code{BOOLEAN} @item showGrid, @code{BOOLEAN}
Whether or not to display the minor grid on the graph. Default: Whether or not to display the minor grid on the graph. Default:
@code{true} @code{true}

View File

@ -38,7 +38,11 @@ if ~o.seriesElements.numSeriesElements()
return; return;
end end
h = figure('visible','off'); if isempty(o.graphSize)
h = figure('visible','off');
else
h = figure('visible','off','position',[1, 1, o.graphSize(1), o.graphSize(2)]);
end
hold on; hold on;
box on; box on;
if o.showGrid if o.showGrid

View File

@ -59,6 +59,8 @@ o.legendFontSize = 8;
o.showZeroline = false; o.showZeroline = false;
o.graphSize = [];
if nargin == 1 if nargin == 1
assert(isa(varargin{1}, 'graph'),['@graph.graph: with one arg you ' ... assert(isa(varargin{1}, 'graph'),['@graph.graph: with one arg you ' ...
'must pass a graph object']); 'must pass a graph object']);
@ -127,6 +129,10 @@ assert(isempty(o.data) || isa(o.data, 'dynSeries'), ['@graph.graph: data must '
assert(isempty(o.seriesToUse) || iscellstr(o.seriesToUse), ['@graph.graph: ' ... assert(isempty(o.seriesToUse) || iscellstr(o.seriesToUse), ['@graph.graph: ' ...
'series to use must be a cell array of string(s)']); 'series to use must be a cell array of string(s)']);
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]']);
% using o.seriesToUse, create series objects and put them in o.seriesElements % using o.seriesToUse, create series objects and put them in o.seriesElements
if ~isempty(o.data) if ~isempty(o.data)
if isempty(o.seriesToUse) if isempty(o.seriesToUse)