Controling Graph(Xlabel=)

For questions and discussion related to graphs, reports, and other output, including issues related to presenting or publishing results.
svannorden
Posts: 16
Joined: Thu Aug 08, 2013 12:23 pm

Controling Graph(Xlabel=)

Unread post by svannorden »

I'm working with a time series that has irregularly-spaced observations (e.g. number of observations per year varies) that I'm displaying with GRAPH. I'm using the XLABEL option to label the observations appropriately.

My problem is that I have far too many observations (>250) to label all of them, so the VECTOR[STRING] that I'm supplying to XLABEL only has the occasional non-null entry. Despite this, RATS allocates margins in order to "stagger" my XLabels (see example, below.)

Is there some way I can force GRAPH to put all my XLabels on the same (single) line (i.e. as with a typical time axis?)
Difference in Impact of Monetary Policy Shocks.pdf
(12.93 KiB) Downloaded 804 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Controling Graph(Xlabel=)

Unread post by TomDoan »

How that lays out depends upon how the labels fit. If you reduce the font size (grparm axislabels fontsize), it will squeeze them together---though you might have to go fairly low to get all of those in.
svannorden
Posts: 16
Joined: Thu Aug 08, 2013 12:23 pm

Re: Controling Graph(Xlabel=)

Unread post by svannorden »

Thanks, Tom.

As I mentioned, I'm using the XLABEL= option on GRAPH() to supply the labels for the time axis. Oddly, the font size doesn't seem to be affected by changes in the HLABEL or the MATRIXLABELS font size on GRPARM. AXISLABELING works, but then it also changes the vertical axis.

Is it possible to change only the font size for the horizon axis labels when using XLABEL= on GRAPH()??
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Controling Graph(Xlabel=)

Unread post by TomDoan »

Those are controlled by the AXISLABELS choice. That's quite a few labels to squeeze onto the axis. Is there a reason you can't drop out more of them?
svannorden
Posts: 16
Joined: Thu Aug 08, 2013 12:23 pm

Re: Controling Graph(Xlabel=)

Unread post by svannorden »

Here's an example (in RGF format) of the problem. Although my labels are few and small, RATS starts to stagger them over multiple lines long before it runs out of space between them.

(It will dynamically rearrange the date labels depending on the size of your screen, so you may have to shrink the graphics window a bit to get to the point where the dates are staggered.)

I'm trying to work around that.
Attachments
Doan.RGF
You should resize the graphics window until RATS starts to stagger the date labels.
(8.19 KiB) Downloaded 934 times
svannorden
Posts: 16
Joined: Thu Aug 08, 2013 12:23 pm

Re: Controling Graph(Xlabel=)

Unread post by svannorden »

TomDoan wrote:Those are controlled by the AXISLABELS choice.
Yes, I know. :)
But AXISLABELS doesn't only change the XLABELS; as I noted, it also changes the vertical axis labels (which I don't need to shrink).
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Controling Graph(Xlabel=)

Unread post by TomDoan »

Do you have a bunch of empty labels? It's figuring the spacing on the basis of 289 label zones (which is why it mysteriously stacks them up, since it thinks the labels are colliding).
svannorden
Posts: 16
Joined: Thu Aug 08, 2013 12:23 pm

Re: Controling Graph(Xlabel=)

Unread post by svannorden »

Lots!
Here's the code that sets up the vector that is passed to XLABEL

Code: Select all

DECLARE VECTOR[STRING] MTDATE(269)
DO I=1,269
    IF %MOD(I,30)==1
        COMPUTE MTDATE(I) = %CONCAT("19",%STRING(MTGYEAR(I)))
END DO I
So only 1 in every 30 strings is non-null.

The reason for the odd timing is that every observations corresponds to an FOMC meeting (This is more work from the Romer&Romer(2004 AER) data set.)
In the early part of the sample, they meet monthly, then 10x/yr, then finally 8x/yr.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Controling Graph(Xlabel=)

Unread post by TomDoan »

We uploaded a new build of version 9 which checks for empty labels when laying out the axis, so it won't mysteriously think there is no room. You probably have to uninstall then redo the installation procedure.
svannorden
Posts: 16
Joined: Thu Aug 08, 2013 12:23 pm

Re: Controling Graph(Xlabel=)

Unread post by svannorden »

Merci, Tom.
Much appreciated.
Post Reply