BookmarkSubscribeRSS Feed
A_Kh
Barite | Level 11

Hello Community, 

While creating matrix plot using the option DIOGANAL=(histogram), tick values are disappearing . Trying to use GTL to modify the template, but don't see any available options in the tmplout-generated code or sas documentations. TEMPLATES with/out tick values don't differ. 
Is there any SG or GTL option available for the MATRIX statement to display tick values even when using DIOGANAL=(histogram) option? 

Please see the below examples.  

1. Tick values displayed without DIOGANAL=(histogram) option. 

proc sgscatter data=sashelp.iris tmplout='C:\Users\Desktop\matrix1.sas';
  title "Scatterplot Matrix for Iris Data";
  matrix sepallength petallength;
run;
title;

the tmplout created template is:

proc template;
define statgraph sgscatter;
begingraph / designwidth=640 designheight=640;
EntryTitle "Scatterplot Matrix for Iris Data" /;
layout lattice / pad=(top=5);
    ScatterPlotMatrix SepalLength PetalLength / subpixel=off NAME="MATRIX";
endlayout;
endgraph;
end;
run;


2. Tick values disappeared with DIOGANAL=(histogram) option. 

proc sgscatter data=sashelp.iris tmplout='C:\Users\Desktop\matrix2.sas';
  title "Scatterplot Matrix for Iris Data";
  matrix sepallength petallength/diagonal=(histogram);
run;
title;

the tmplout created template is:

proc template;
define statgraph sgscatter;
begingraph / designwidth=640 designheight=640 subpixel=on;
EntryTitle "Scatterplot Matrix for Iris Data" /;
layout lattice / pad=(top=5);
    ScatterPlotMatrix SepalLength PetalLength / subpixel=off NAME="MATRIX" diagonal=( histogram );
endlayout;
endgraph;
end;
run;




2 REPLIES 2
DanH_sas
SAS Super FREQ

Unfortunately, there is not a good way to achieve what you requested. The histograms have different axis ranges from the scatter plots, so the unified external row/column axes around the matrix cannot be created without negatively impacting the visual. The best you could do would be to create a Layout Lattice in GTL and, using internal axes, add the scatter plots and histograms in the desired order.

Ksharp
Super User

You want this ?

 

/*Example 1*/
ods listing gpath="%sysfunc(pathname(work))" image_dpi=300 style=htmlblue;
ods graphics / reset=all imagename='sepallength' noborder width=80px height=80px;
ods html exclude sgplot;   
/*generate a histogram graph*/
title;
proc sgplot data=sashelp.iris pad=0  noborder noautolegend;
histogram sepallength ;
xaxis display=none;
yaxis display=none;
run;

ods listing gpath="%sysfunc(pathname(work))" image_dpi=300 style=htmlblue;
ods graphics / reset=all imagename='petallength' noborder width=80px height=80px;
ods html exclude sgplot;   
/*generate a histogram graph*/
title;
proc sgplot data=sashelp.iris pad=0  noborder noautolegend;
histogram petallength ;
xaxis display=none;
yaxis display=none;
run;



%sganno
data sganno;
%SGIMAGE(IMAGE="%sysfunc(pathname(work))\sepallength.png",ANCHOR="topleft",BORDER="FALSE",DRAWSPACE="LAYOUTPERCENT" ,x1=6,y1=93)
%SGIMAGE(IMAGE="%sysfunc(pathname(work))\petallength.png",ANCHOR="topleft",BORDER="FALSE",DRAWSPACE="LAYOUTPERCENT" ,x1=54,y1=48)
run;

ods graphics/reset;
proc sgscatter data=sashelp.iris sganno=sganno;
  title "Scatterplot Matrix for Iris Data";
  matrix sepallength petallength;
run;

Ksharp_0-1770371187829.png

 

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 112 views
  • 4 likes
  • 3 in conversation