Most users of the ODS Graphics system have probably had the need to adjust the dimensions of their graph output at times. The ODS GRAPHICS statement makes this easy to do. This statement supports the WIDTH= and HEIGHT= options. If you set just one of these, the system will calculate the other value so as to maintain the same aspect ratio for the graph. You can set both the options to force a specific dimension.
When you change the graph size, the system automatically adjusts the marker and font sizes of your new output. Also tweaked are any gutters, pad values or other ‘gaps’ in the graph. This keeps the contents of your graph in proportion to the output size.
Here is a scatter plot example with data labels turned on:
The default height is 480 pixels. Let us say you want a smaller output, 300 pixels high, for a thumbnail image. So we set the HEIGHT= option in the ods graphics statement accordingly:
ods graphics / height=300px;
This output is shown below:
You will notice that the fonts and markers are slightly smaller here. The gap between the discrete legend and the wall border has also been slightly reduced. The ODS Graphics system uses non-linear scaling to adjust the markers, fonts and gaps to retain the same visual feel for their relative sizes. This behavior is controlled by the SCALE= option on the ODS GRAPHICS statement, which is ON by default. So in effect, it is as if you had the following statement in your program:
ods graphics / scale=ON height=300px;
Note that you can also use SCALE and NOSCALE flags to set this option. Setting SCALE to OFF will retain the original size of the contents regardless of the output size. Shown below is the same graph as above, except with the SCALE flag turned off:
ods graphics / scale=OFF height=300px;
The marker, font and gap sizes in the above output are the same as the default-sized image. When reducing the image size, it is usually best to leave the SCALE option set to ON, unless you are graphing sparse data and there is less likelihood of the markers and labels colliding.
The SCALE option persists for the life-time of the ODS GRAPHICS statement. If you wish to revert to the default you can reset the value as follows:
ods graphics / reset=scale ; /* Reset only scale */ ods graphics / reset=ALL ; /* Reset all graphics options */
The scaling feature also comes into play when you increase your output size. Let us now generate a larger output by changing the height to 700 pixels with SCALE option set to ON:
ods graphics / scale=on height=700px;
The output is shown below:
Did you notice the larger font and marker sizes above? The increased gap between the discrete legend and the wall border is also noticeable.
There may be times when you need to increase the white space in your output while retaining the original sizes of the fonts and markers when you increase the output size. You can do that by setting the SCALE to OFF, as we saw earlier. Here is the same sized output with no scaling:
Once again, compare the text, markers and gaps with the previous images. Notice that they have the same size as in the original image of default height.
This option may come in handy the next time you time you want to shrink a plot or you want to enlarge the output and you want the data labels and markers to have more “breathing room”!