reporting: make graph line markers work with tikz

time-shift
Houtan Bastani 2014-02-12 16:13:35 +01:00
parent 645af86c40
commit be1819b282
4 changed files with 30 additions and 24 deletions

View File

@ -10868,17 +10868,17 @@ Line style for this series in a graph. Default: @code{`solid'}
@item graphLineWidth @code{DOUBLE}
Line width for this series in a graph. Default: @code{0.5}
@item graphMarker, @code{`+'} | @code{`o'} | @code{`*'} | @code{`.'} | @code{`x'} | @code{`s'} | @code{`square'} | @code{`d'} | @code{`diamond'} | @code{`^'} | @code{`v'} | @code{`>'} | @code{`<'} | @code{`p'} | @code{`pentagram'} | @code{`h'} | @code{`hexagram'} | @code{`none'}
@item graphMarker, @code{`x'} | @code{`+'} | @code{`-'} | @code{`|'} | @code{`o'} | @code{`asterisk'} | @code{`star'} | @code{`10-pointed star'} | @code{`oplus'} | @code{`oplus*'} | @code{`otimes'} | @code{`otimes*'} | @code{`square'} | @code{`square*'} | @code{`triangle'} | @code{`triangle*'} | @code{`diamond'} | @code{`diamond*'} | @code{`halfdiamond*'} | @code{`halfsquare*'} | @code{`halfsquare right*'} | @code{`halfsquare left*'} | @code{`Mercedes star'} | @code{`Mercedes star flipped'} | @code{`halfcircle'} | @code{`halfcircle*'} | @code{`pentagon'} | @code{`pentagon star'}
The Marker to use on this series in a graph. Default: @code{none}
@item graphMarkerEdgeColor, @code{MATLAB_COLOR}
The edge color of the graph marker. Default: @code{`auto'}
@item graphMarkerEdgeColor, @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'}
The edge color of the graph marker. Default: @code{graphLineColor}
@item graphMarkerFaceColor, @code{MATLAB_COLOR}
The face color of the graph marker. Default: @code{`auto'}
@item graphMarkerFaceColor, @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'}
The face color of the graph marker. Default: @code{graphLineColor}
@item graphMarkerSize, @code{DOUBLE}
The size of the graph marker. Default: @code{6}
The size of the graph marker. Default: @code{1}
@item tableDataRhs, @code{dseries}
A series to be added to the right of the current series. Usefull for

View File

@ -40,9 +40,9 @@ o.graphLineStyle = 'solid';
o.graphLineWidth = 0.5;
o.graphMarker = '';
o.graphMarkerEdgeColor = 'auto';
o.graphMarkerFaceColor = 'auto';
o.graphMarkerSize = 6;
o.graphMarkerEdgeColor = '';
o.graphMarkerFaceColor = '';
o.graphMarkerSize = 1;
o.tableShowMarkers = false;
o.tableNegColor = 'red';

View File

@ -44,9 +44,11 @@ assert(isfloat(o.graphLineWidth) && o.graphLineWidth > 0, ...
'@report_series.writeLine: graphLineWidth must be a positive number');
% GraphMarker
valid_graphMarker = {'+', 'o', '*', '.', 'x', 's', 'square', 'd', 'diamond', ...
'^', 'v', '>', '<', 'p', 'pentagram', 'h', 'hexagram', ...
'none'};
valid_graphMarker = {'x', '+', '-', '|', 'o', 'asterisk', 'star', '10-pointed star', 'oplus', ...
'oplus*', 'otimes', 'otimes*', 'square', 'square*', 'triangle', 'triangle*', 'diamond', ...
'diamond*', 'halfdiamond*', 'halfsquare*', 'halfsquare right*', ...
'halfsquare left*','Mercedes star','Mercedes star flipped','halfcircle',...
'halfcircle*','pentagon','pentagon star'};
assert(isempty(o.graphMarker) || any(strcmp(o.graphMarker, valid_graphMarker)), ...
['@report_series.writeLine: graphMarker must be one of ' strjoin(valid_graphMarker)]);
@ -82,20 +84,21 @@ if any(stz)
thedata(stz) = 0;
end
fprintf(fid, '%%series %s\n\\addplot[color=%s,%s,line width=%fpt,forget plot,line join=round]\ntable[row sep=crcr]{\nx y\\\\\n', ...
fprintf(fid, '%%series %s\n\\addplot[color=%s,%s,line width=%fpt,forget plot,line join=round',...
o.data.name{:}, o.graphLineColor, o.graphLineStyle, o.graphLineWidth);
if ~isempty(o.graphMarker)
if isempty(o.graphMarkerEdgeColor)
o.graphMarkerEdgeColor = o.graphLineColor;
end
if isempty(o.graphMarkerFaceColor)
o.graphMarkerFaceColor = o.graphLineColor;
end
fprintf(fid, ',mark=%s,mark size=%f,every mark/.append style={draw=%s,fill=%s}',...
o.graphMarker,o.graphMarkerSize,o.graphMarkerEdgeColor,o.graphMarkerFaceColor);
end
fprintf(fid,']\ntable[row sep=crcr]{\nx y\\\\\n');
for i=1:ds.dates.ndat
fprintf(fid, '%d %f\\\\\n', i, thedata(i));
end
fprintf(fid,'};\n');
%opt = {'XData', 1:length(thedata)};
if ~isempty(o.graphMarker)
%opt = {opt{:}, 'Marker', o.graphMarker};
%opt = {opt{:}, 'MarkerSize', o.graphMarkerSize};
%opt = {opt{:}, 'MarkerEdgeColor', o.graphMarkerEdgeColor};
%opt = {opt{:}, 'MarkerFaceColor', o.graphMarkerFaceColor};
end
end

View File

@ -158,7 +158,10 @@ rep = rep.addGraph('title', 'World Real Oil Price Index', ...
db_q = db_q.tex_rename('LRPOIL_WORLD', 'Oil Price');
rep = rep.addSeries('data', db_q{'LRPOIL_WORLD'}, ...
'graphLineColor', 'blue', ...
'graphLineWidth', 1.5);
'graphLineWidth', 1.5, ...
'graphMarker', 'triangle*', ...
'graphMarkerEdgeColor','black', ...
'graphMarkerSize',4);
db_q = db_q.tex_rename('LRPOIL_BAR_WORLD', 'Equilibrium Oil Price');
rep = rep.addSeries('data', db_q{'LRPOIL_BAR_WORLD'}, ...
'graphLineColor', 'green', ...