With SGPanel, I'm creating two heatmaps arranged in a single column. The y-axis variable for the two heatmaps is discrete, and this variable has more distinct values in the top heatmap (i.e., the top panel) than in the bottom heatmap. Thus, in the PANELBY statement I'm using the PROPORTIONAL and UNISCALE=COLUMN options to scale the panels so that the y-axis tick spacing is the same in both panels. See Figure 1 below for a dummy example using the sashelp.cars dataset. Notice that the top panel is taller to make room for the greater number of distinct y-axis values, and the colored cells of the heatmaps are the same size between the panels.
The problem is I also want an axistable on the x-axis (i.e., a COLAXISTABLE), but adding this messes up the proportional spacing of the panels. See Figure 2 where, with the axistable, the colored cells in the top heatmap are taller than those in the bottom heatmap.
Any thoughts on how to fix Figure 2, so I can have my axistable and maintain the proportional spacing?
See my code below to generate Figures 1 and 2. I ran this in SAS Studio using SAS version 9.04.01M6P11072018.
data cars;
set sashelp.cars;
where origin = 'Asia' or (origin = 'Europe' and type in ('Sedan' 'Wagon'));
run;
ods graphics / width=4in height=6in border;
ods layout gridded advance=table columns=2;
title 'Fig. 1: Y-axis spacing is consistent between the two panels';
proc sgpanel data=cars;
panelby origin / layout=rowlattice uniscale=column proportional spacing=5;
heatmap x=drivetrain y=type / outline;
rowaxis discreteorder=unformatted;
run;
title 'Fig. 2: Y-axis spacing is NOT consistent between the two panels when using COLAXISTABLE';
proc sgpanel data=cars;
panelby origin / layout=rowlattice uniscale=column proportional spacing=5;
heatmap x=drivetrain y=type / outline;
rowaxis discreteorder=unformatted;
colaxistable msrp weight / stat=mean separator;
run;
ods layout end;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.