reporting: add custom height/width to graphs

time-shift
Houtan Bastani 2014-02-11 13:21:23 +01:00
parent 233016a667
commit e64d1e0952
3 changed files with 16 additions and 4 deletions

View File

@ -10718,7 +10718,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, xTicks, xTickLabels, yrange, showZeroline
@defmethod Report addGraph data, figname, figDirName, graphSize, height, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, width, xlabel, ylabel, xrange, xTicks, xTickLabels, yrange, showZeroline
Adds a @code{Graph} to a @code{Section}.
@optionshead
@table @code
@ -10741,6 +10741,9 @@ 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 height, @code{DOUBLE}
The height of the graph, in inches. Default: @code{4.5}
@item showGrid, @code{BOOLEAN}
Whether or not to display the minor grid on the graph. Default:
@code{true}
@ -10782,6 +10785,9 @@ The opacity of the shaded area, must be in @math{[0,1]}. Default: @code{.2}
@item title, @code{STRING}
Title for the graph. Default: @code{none}
@item width, @code{DOUBLE}
The width of the graph, in inches. Default: @code{6.0}
@item xlabel, @code{STRING}
The x-axis label. Default: @code{none}

View File

@ -64,6 +64,9 @@ o.graphSize = [];
o.xTicks = [];
o.xTickLabels = {};
o.width = 6;
o.height = 4.5;
if nargin == 1
assert(isa(varargin{1}, 'graph'),['@graph.graph: with one arg you ' ...
'must pass a graph object']);
@ -104,6 +107,9 @@ assert(ischar(o.shadeColor), '@graph.graph: shadeColor must be a string');
assert(isfloat(o.shadeOpacity) && length(o.shadeOpacity)==1 && ...
o.shadeOpacity >= 0 && o.shadeOpacity <= 1, ...
'@graph.graph: o.shadeOpacity must be a real in [0 1]');
assert(isfloat(o.width), '@graph.graph: o.width must be a real number');
assert(isfloat(o.height), '@graph.height: o.width must be a real number');
valid_legend_locations = ...
{'North', 'South', 'East', 'West', ...
'NorthEast', 'SouthEast', 'NorthWest', 'SouthWest', ...

View File

@ -87,13 +87,13 @@ for i = 1:length(x)
end
end
fprintf(fid, '},\nx tick label style={rotate=45,anchor=east},\n');
fprintf(fid, ['width=6.0in,\n'...
'height=4.5in,\n'...
fprintf(fid, ['width=%fin,\n'...
'height=%fin,\n'...
'scale only axis,\n'...
'xmin=1,\n'...
'xmax=%d,\n'...
'ymin=%d,\n'...
'ymax=%d,\n'], dd.ndat, ymin, ymax);
'ymax=%d,\n'], o.width, o.height, dd.ndat, ymin, ymax);
if o.showGrid
fprintf(fid, 'xmajorgrids=true,\nymajorgrids=true,\n');