This project is read-only.

Changing the 'titles' fontsize when using 'dbplot'

Topics: IRIS in General, Reporting
Nov 3, 2014 at 10:18 PM
Hi All,

I'm new to IRIS and have a quick question.

Basically, my goal is to plot some IRFs with the names of the different variables using the 'dbplot' function.

The only issue I have is that when I use the option 'titles', these variable names appear too small for my purposes.

Is there any quick/easy way to increase the fontsize of the variable 'titles' on the plot?

Below is the relevant section of my code:

plotrng = startDate : startDate+40;
series = {'100(r^4-1)','100(pic^4-1)','100(y-1)', ...
dbplot(s,plotrng,series,'tight',true,'titles=', {'r (annualized)' 'pic (annualized)' 'y' 'rf' 'rg' 'c'});
ftitle('Monetary Policy Shock');

Thanks in advance for any help (and sorry if the question is too 'basic'!)
Nov 4, 2014 at 1:53 AM
Welcome to IRIS. The answer depends on what version of MATLAB you're using because of the change from HG1 to HG2 recently. Suppose you have a plot like this:
[fh,ah] = dbplot(d,{'X','Y'},qq(2007,1):qq(2017,4))
With HG2 (by requirement in R2014b or optionally in earlier versions) you can use
ah{fnum}(snum).Title.FontSize = K ;
to set the font size for subplot snum of figure fnum to size K.

With HG1 I'm not sure. You can't set title font size in HG1 without a handle to the title, as far as I know, and dbplot() doesn't return handles to titles. If you are using an older version of MATLAB then your best option is probably to use qreport. Technically dbplot calls qreport, but if you want control over the way things look then it's usually easier to move to qreport directly.
Marked as answer by jaromirbenes on 11/3/2014 at 6:38 PM
Nov 4, 2014 at 2:38 AM
Edited Nov 4, 2014 at 2:40 AM

You can also use the option 'style=' directly in the dbplot( ) command, passing in a struct that describes the graphics properties you want to modify in each graph. Note also two other features of convenience you can use in your example code. First, you can include the titles for each series plotted directly in the expressions to be plotted (i.e. in cell array series). The titles need to precede the respective expressions and have to be enclosed in double quotes. This is usually a little bit more convenient than using the option 'title='. Second, if you apply the same transformation to each variable (in your case 100*(xxx-1) where xxx is a thing like r^4 or y in your example), you can define it as a function handle through the option 'transform='.

Combined all together, your code can be re-written as follows:
sty = struct( );
sty.title.fontSize = 15; % or whatever font size you wish...
% You can also add things like:
% sty.axes.xgrid = 'on';
% sty.axes.ygrid = 'on';
% sty.line.lineWidth = {2, 1, 1};
% sty.line.lineStyle = {'-', '--', '-.'};
% etc.

series = { ...
    ' "rate (annualized)" r^4', ...
    ' "consumer inflation (annualized)" pic^4', ...
    ' "output" y', ... 
    ' "hard to say what rf is" rf^4', ...
    ' "even harder to guess" rg^4',...
    ' "this could be consumption" c', ...

dbplot(s,plotrng,series, ...
    'tight=',true, ...
    'style=',sty, ...
    'transform=', @(x) 100*(x-1) );
ftitle('Monetary Policy Shock'); 
Hope this helps.

Marked as answer by jaromirbenes on 11/3/2014 at 6:38 PM
Nov 4, 2014 at 3:07 PM
Michael and Jaromir,

Thanks to both of you for your quick responses.

I’m using MATLAB R2013a, so I used Jaromir ‘tricks’ and they worked perfectly. That’s what I needed and learned a couple of other things on the side. I can’t be happier!

@Michael: As a side note, I’m writing from one ‘institution’ in Canada where I currently work as a RA. I heard lots of positive things about the time you were in the ‘Model Development’ division of my department.

Again, thanks a lot to both of you!
Nov 4, 2014 at 3:18 PM
Yeah, observations are now mounting from all around the world that people start longing for Michael the moment he is kicked out of a country... :)))
Nov 10, 2014 at 6:38 PM
No doubts on Michael. But if you just paid attention you'd notice that some people pretty much long to learn from you.