## varying y-axis length

Solved
Occasional Contributor
Posts: 17

# varying y-axis length

I'm using GTL and SAS v 9.4. Is there a way to vary the lengths of the y-axis in my template (top & bottom graphs using layout lattice/rows=2) so that the lengths of the y-axis (percentage) will be of varying lengths, with the maximum being a certain value, say, 10% above the maximum percentage value in the data? I.e., a "floating" y-axis length for each graph. Thanks.

Accepted Solutions
Solution
‎12-19-2017 12:41 PM
SAS Super FREQ
Posts: 1,263

## Re: varying y-axis length

If you have a LATTICE layout, you can set the ROWWEIGHTS (or COLUMNWEIGHTS) option to make the ROWS (or COLUMNS) of the height you want based on the proportion between the two Y axes.  If you want this to be dynamically controlled, you could use ROWWEIGHTS=dynamic, where the dynamic is the the text string providing the values, such as "0.6 0.4" not including the quotes or the parentheses.  Then, you can generate this dynamic string based on the use case.

The actual axis length is always computed based on the size of the cell.  There is no way to specify an axis length in GTL.  If you want, you can keep the cells constant size and set a PAD value to provide more white space above the y-axis.

All Replies
Super User
Posts: 13,008

## Re: varying y-axis length

I won't say "no" but since GTL has to live with other things like ODS GRAPHICS that can set the entire available graphics space then trying to set a fixed length inside GTL is likely to have bad interactions when someone changes display area size.

You could make the axis statement flexible by using a parameter that sets the max value of the axis if you calculate it before the SGRENDER that calls the template.

Generic answer to generic question. If you show your code for the template you may get better suggestions. Best would include some example data in the form of a data step to allow testing code. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

Occasional Contributor
Posts: 17

## Re: varying y-axis length

[ Edited ]

thank you ballardw

Solution
‎12-19-2017 12:41 PM
SAS Super FREQ
Posts: 1,263

## Re: varying y-axis length

If you have a LATTICE layout, you can set the ROWWEIGHTS (or COLUMNWEIGHTS) option to make the ROWS (or COLUMNS) of the height you want based on the proportion between the two Y axes.  If you want this to be dynamically controlled, you could use ROWWEIGHTS=dynamic, where the dynamic is the the text string providing the values, such as "0.6 0.4" not including the quotes or the parentheses.  Then, you can generate this dynamic string based on the use case.

The actual axis length is always computed based on the size of the cell.  There is no way to specify an axis length in GTL.  If you want, you can keep the cells constant size and set a PAD value to provide more white space above the y-axis.

Occasional Contributor
Posts: 17