diff --git a/doc/dynare.texi b/doc/dynare.texi
index ce6c21f3700d060dd21e56e9c40b739ae5dab110..91f9f00e16db643732133fec81301e2840208ead 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -10338,7 +10338,7 @@ command. Default: @code{`!'}
 @end table
 @end defmethod
 
-@defmethod Report addGraph data, figname, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, xTickLabels, yrange, showZeroline
+@defmethod Report addGraph data, figname, figDirName, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, xTickLabels, yrange, showZeroline
 Adds a @code{Graph} to a @code{Section}.
 @optionshead
 @table @code
@@ -10351,6 +10351,10 @@ The @code{dseries} that provides the data for the graph. Default:
 The name to use when saving this figure. Default: @code{[tempname
 `.tex']}
 
+@item figDirName, @code{STRING}
+The name of the folder in which to store this figure. Default:
+@code{tmpFigDir}
+
 @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
diff --git a/matlab/reports/@graph/createGraph.m b/matlab/reports/@graph/createGraph.m
index 98543ff0d8aea6c48b59c655e82994666a602cd4..49ce04f8d2b31189e0184d8f01ef8cce10217551 100644
--- a/matlab/reports/@graph/createGraph.m
+++ b/matlab/reports/@graph/createGraph.m
@@ -135,12 +135,11 @@ end
 drawnow;
 
 if isempty(o.figname)
-    tn = tempname;
+    [junk, tn] = fileparts(tempname);
     if strcmp(computer, 'PCWIN') || strcmp(computer, 'PCWIN64')
-        tn = strrep(tn, '\', '/');
         tn = strrep(tn, '_', '\_');
     end
-    o.figname = [tn '.tex'];
+    o.figname = [o.figDirName filesep tn '.tex'];
 end
 disp('  converting to tex....');
 if isoctave && isempty(regexpi(computer, '.*apple.*', 'once'))
diff --git a/matlab/reports/@graph/graph.m b/matlab/reports/@graph/graph.m
index c328f823dd325387bd9c78d4f818fbaf8cd23abc..812d989920cf4bc7c00eb141fc0a3922d3a6c760 100644
--- a/matlab/reports/@graph/graph.m
+++ b/matlab/reports/@graph/graph.m
@@ -39,6 +39,7 @@ o.title = '';
 o.ylabel = '';
 o.xlabel = '';
 
+o.figDirName = 'tmpFigDir';
 o.figname = '';
 o.data = '';
 o.seriesToUse = '';
@@ -92,6 +93,7 @@ assert(ischar(o.title), '@graph.graph: title must be a string');
 assert(ischar(o.xlabel), '@graph.graph: xlabel file must be a string');
 assert(ischar(o.ylabel), '@graph.graph: ylabel file must be a string');
 assert(ischar(o.figname), '@graph.graph: figname must be a string');
+assert(ischar(o.figDirName), '@graph.graph: figDirName must be a string');
 assert(islogical(o.showGrid), '@graph.graph: showGrid must be either true or false');
 assert(islogical(o.showLegend), '@graph.graph: showLegend must be either true or false');
 assert(islogical(o.showLegendBox), '@graph.graph: showLegendBox must be either true or false');
@@ -150,6 +152,10 @@ end
 o = rmfield(o, 'seriesToUse');
 o = rmfield(o, 'data');
 
+if ~exist(o.figDirName, 'file')
+    mkdir(o.figDirName);
+end
+
 % Create graph object
 o = class(o, 'graph');
 end
\ No newline at end of file