Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dynare
reporting
Commits
982c6b8c
Commit
982c6b8c
authored
Dec 23, 2014
by
Houtan Bastani
Browse files
reporting: add support for bar graphs, closes #809
parent
945403e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
@report_series/report_series.m
View file @
982c6b8c
...
...
@@ -53,6 +53,11 @@ o.graphMiscTikzAddPlotOptions = '';
o
.
graphHline
=
{};
o
.
graphVline
=
dates
();
o
.
graphBar
=
false
;
o
.
graphBarColor
=
'black'
;
o
.
graphBarFillColor
=
'black'
;
o
.
graphBarWidth
=
2
;
o
.
tableShowMarkers
=
false
;
o
.
tableNegColor
=
'red'
;
o
.
tablePosColor
=
'blue'
;
...
...
@report_series/writeSeriesForGraph.m
View file @
982c6b8c
...
...
@@ -46,6 +46,13 @@ assert(ischar(o.graphLineStyle), '@report_series.writeSeriesForGraph: graphLineS
assert
(
isfloat
(
o
.
graphLineWidth
)
&&
o
.
graphLineWidth
>
0
,
...
'@report_series.writeSeriesForGraph: graphLineWidth must be a positive number'
);
% Bar
assert
(
islogical
(
o
.
graphBar
),
'@report_series.writeSeriesForGraph: graphBar must be either true or false'
);
assert
(
ischar
(
o
.
graphBarColor
),
'@report_series.writeSeriesForGraph: graphBarColor must be a string'
);
assert
(
ischar
(
o
.
graphBarFillColor
),
'@report_series.writeSeriesForGraph: graphBarFillColor must be a string'
);
assert
(
isfloat
(
o
.
graphBarWidth
)
&&
o
.
graphBarWidth
>
0
,
...
'@report_series.writeSeriesForGraph: graphbarWidth must be a positive number'
);
% GraphMarker
valid_graphMarker
=
{
'x'
,
'+'
,
'-'
,
'|'
,
'o'
,
'asterisk'
,
'star'
,
'10-pointed star'
,
'oplus'
,
...
'oplus*'
,
'otimes'
,
'otimes*'
,
'square'
,
'square*'
,
'triangle'
,
'triangle*'
,
'diamond'
,
...
...
...
@@ -113,18 +120,23 @@ fprintf(fid,'};\n');
end
function
writeLineOptions
(
o
,
fid
)
fprintf
(
fid
,
'[color=%s,%s,line width=%fpt,line join=round'
,
...
o
.
graphLineColor
,
o
.
graphLineStyle
,
o
.
graphLineWidth
);
if
o
.
graphBar
fprintf
(
fid
,
'[ybar,color=%s,fill=%s,line width=%fpt'
,
...
o
.
graphBarColor
,
o
.
graphBarFillColor
,
o
.
graphBarWidth
);
else
fprintf
(
fid
,
'[color=%s,%s,line width=%fpt,line join=round'
,
...
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
;
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
,
',mark=%s,mark size=%f,every mark/.append style={draw=%s,fill=%s}'
,
...
o
.
graphMarker
,
o
.
graphMarkerSize
,
o
.
graphMarkerEdgeColor
,
o
.
graphMarkerFaceColor
);
end
if
~
isempty
(
o
.
graphMiscTikzAddPlotOptions
)
fprintf
(
fid
,
',%s'
,
o
.
graphMiscTikzAddPlotOptions
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment