Commit 57836895 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

reporting (WIP)

parent f89edf47
...@@ -3,10 +3,10 @@ function o = createGraph(o) ...@@ -3,10 +3,10 @@ function o = createGraph(o)
% Create the graph % Create the graph
% %
% INPUTS % INPUTS
% none % o - Graph Object
% %
% OUTPUTS % OUTPUTS
% none % o - Graph Object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none
...@@ -37,9 +37,14 @@ end ...@@ -37,9 +37,14 @@ end
%o = readConfig(o); %o = readConfig(o);
disp('creating plot..........');
h = figure('visible','off'); h = figure('visible','off');
hold on; hold on;
box on; box on;
if o.grid
grid on;
set(gca, 'GridLineStyle', '--');
end
%set(0, 'CurrentFigure',h); %set(0, 'CurrentFigure',h);
%set(h, 'PaperPositionMode', 'auto'); %set(h, 'PaperPositionMode', 'auto');
%set(h, 'units', 'normalized', 'outerposition', [0 0 1 1]); %set(h, 'units', 'normalized', 'outerposition', [0 0 1 1]);
...@@ -90,16 +95,18 @@ if ~isempty(o.ylabel) ...@@ -90,16 +95,18 @@ if ~isempty(o.ylabel)
end end
if ~isempty(o.title) if ~isempty(o.title)
title(['$\textbf{\large ' o.title '}$'],'Interpreter','LaTex'); title( o.title , 'interpreter', 'none', 'FontSize', 20);
end end
drawnow; drawnow;
o.figname = ['figure-' num2str(cputime) '.tex']; o.figname = ['figure-' num2str(cputime) '.tex'];
disp(' converting to tex....');
matlab2tikz('filename', o.figname, ... matlab2tikz('filename', o.figname, ...
'showInfo', false, ... 'showInfo', false, ...
'showWarnings', false, ... 'showWarnings', false, ...
'checkForUpdates', false); 'checkForUpdates', false);
grid off;
box off; box off;
hold off; hold off;
close(h); close(h);
......
...@@ -44,6 +44,8 @@ o.data = ''; ...@@ -44,6 +44,8 @@ o.data = '';
o.seriestoplot = 'all'; o.seriestoplot = 'all';
o.shade = ''; %{1959q1:1964q4} o.shade = ''; %{1959q1:1964q4}
o.grid = true;
o.legend = false; o.legend = false;
o.legend_location = 'SouthEast'; o.legend_location = 'SouthEast';
o.legend_orientation = 'horizontal'; o.legend_orientation = 'horizontal';
......
...@@ -33,6 +33,7 @@ o = struct; ...@@ -33,6 +33,7 @@ o = struct;
o.paper = ''; o.paper = '';
o.title = ''; o.title = '';
o.orientation = ''; o.orientation = '';
o.footnote = '';
o.sections = sections(); o.sections = sections();
if nargin == 1 if nargin == 1
......
...@@ -32,8 +32,15 @@ assert(fid ~= -1); ...@@ -32,8 +32,15 @@ assert(fid ~= -1);
fprintf(fid, '\n%% Page Object\n'); fprintf(fid, '\n%% Page Object\n');
if ~isempty(o.title) if ~isempty(o.title)
fprintf(fid, '\\centerline{{\\Large %s}}\n', o.title); fprintf(fid, '\\centerline{\\large\\textbf{%s}}\n', o.title);
end end
if ~isempty(o.footnote)
for i=1:length(o.footnote)
fprintf(fid, '\\blfootnote{\\tiny %d. %s}', i, o.footnote{i});
end
end
if strcmpi(o.orientation, 'landscape') if strcmpi(o.orientation, 'landscape')
fprintf(fid, '\\begin{landscape}\n') fprintf(fid, '\\begin{landscape}\n')
end end
......
...@@ -34,10 +34,11 @@ o = struct; ...@@ -34,10 +34,11 @@ o = struct;
o.title = ''; o.title = '';
o.orientation = 'portrait'; o.orientation = 'portrait';
o.paper = 'a4'; o.paper = 'a4';
o.margin = '2cm'; o.margin = '2.5cm';
o.pages = pages(); o.pages = pages();
o.filename = 'report.tex'; o.filename = 'report.tex';
o.config = ''; o.config = '';
o.showdate = true;
if nargin == 1 if nargin == 1
assert(isa(varargin{1}, 'report'),['With one arg to Report constructor, ' ... assert(isa(varargin{1}, 'report'),['With one arg to Report constructor, ' ...
......
...@@ -41,10 +41,18 @@ if strcmpi(o.orientation, 'landscape') ...@@ -41,10 +41,18 @@ if strcmpi(o.orientation, 'landscape')
fprintf(fid, ',landscape'); fprintf(fid, ',landscape');
end end
fprintf(fid, ']{geometry}\n'); fprintf(fid, ']{geometry}\n');
fprintf(fid, '\\usepackage{graphicx}\n'); fprintf(fid, '\\usepackage{graphicx, pdflscape, pgf, pgfplots}\n');
fprintf(fid, '\\usepackage{pdflscape}\n'); fprintf(fid, ['\\makeatletter\n' ...
fprintf(fid, '\\usepackage{pgf}\n'); '\\def\\blfootnote{\\gdef\\@thefnmark{}\\@footnotetext}\n' ...
fprintf(fid, '\\usepackage{pgfplots}\n'); '\\makeatother\n']);
if o.showdate
fprintf(fid, '\\usepackage{fancyhdr, datetime}\n');
fprintf(fid, '\\newdateformat{reportdate}{\\THEDAY\\ \\shortmonthname\\ \\THEYEAR}\n');
fprintf(fid, '\\pagestyle{fancy}\n');
fprintf(fid, '\\renewcommand{\\headrulewidth}{0pt}\n');
fprintf(fid, '\\renewcommand{\\footrulewidth}{0.5pt}\n');
fprintf(fid, '\\rfoot{\\scriptsize\\reportdate\\today\\ -- \\currenttime}\n');
end
fprintf(fid, '\\begin{document}\n'); fprintf(fid, '\\begin{document}\n');
o.pages.write(fid); o.pages.write(fid);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment