Dear SAS Community,
Is there a way to fit all these 6 radar graphs I have in one panel, so that I end up with the first 3 radar graphs in one upper row, and the last 3 radar graphs in a lower row? The goal is to fit them in one figure. Please see below my code for each of the individual radar plots. I would greatly appreciate your help!!
Thank you very much Ksharp, I will try to work with these options.
In addition to the suggestions already made, you could use the GREPLAY procedure to combine the radar charts into one page using PROC GREPLAY.
Below is a modification of your sample code that uses PROC GREPLAY to create a plot with two rows and 3 columns.
Note that I separated the title text into a TITLE1 and TITLE2 statement for readability in a smaller panel.
You can also find more information about combining plots in the following blog: https://blogs.sas.com/content/sgf/2016/09/16/do-you-need-multiple-graphs-on-a-page-we-have-got-you-c...
Hope that helps.
Marcia
data wide;
length DM_range $10;
length Variety $10;
input DM_range $ Variety $ a_texture b_texture c_texture d_texture e_texture f_texture g_texture;
if Variety='LB' then Variety='I49L';
if Variety='Junior' then Variety='I54J';
if Variety='Bumpy' then Variety='I55B';
if Variety='EG' then Variety='I12E';
datalines;
<15 LB 50.00 50.00 66.67 0.00 0.00 50.00 0.00
<15 Bumpy 17.07 31.71 34.15 7.32 0.00 82.93 0.00
<15 BL516 0.00 50.00 25.00 0.00 25.00 50.00 0.00
<15 Hass 0.00 0.00 0.00 0.00 0.00 0.00 0.00
<15 Junior 0.00 0.00 0.00 0.00 0.00 0.00 0.00
<15 GEM 0.00 0.00 0.00 0.00 0.00 0.00 0.00
<15 EG 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15_20 LB 31.52 23.91 33.70 19.57 9.78 51.09 2.17
15_20 Bumpy 18.09 15.96 38.30 8.51 2.13 81.91 1.06
15_20 BL516 10.71 30.36 12.50 23.21 1.79 75.00 5.36
15_20 Hass 43.15 24.32 44.52 6.16 5.48 44.18 2.05
15_20 Junior 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15_20 GEM 19.05 33.33 28.57 9.52 0.00 85.71 4.76
15_20 EG 50.68 23.29 52.05 4.11 1.37 50.68 0.00
20_25 LB 24.73 19.35 40.86 12.90 5.38 48.39 5.38
20_25 Bumpy 32.35 24.71 37.06 7.06 4.71 52.35 2.35
20_25 BL516 26.42 24.53 29.25 2.83 0.94 69.81 3.77
20_25 Hass 47.31 21.51 45.52 6.81 6.81 30.11 3.58
20_25 Junior 49.30 32.39 43.66 16.90 5.63 30.99 1.41
20_25 GEM 20.00 28.00 20.00 6.67 0.00 84.00 0.00
20_25 EG 72.56 31.10 60.98 3.66 1.83 22.56 2.44
25_30 LB 48.33 13.33 51.67 23.33 3.33 26.67 3.33
25_30 Bumpy 25.00 19.44 47.22 0.00 8.33 58.33 2.78
25_30 BL516 34.15 22.93 42.93 7.32 2.44 44.88 3.41
25_30 Hass 61.84 21.71 55.92 6.14 7.68 11.40 2.63
25_30 Junior 60.56 28.33 40.56 5.56 6.11 26.11 2.78
25_30 GEM 59.38 18.75 53.13 0.00 6.25 31.25 6.25
25_30 EG 75.47 26.42 60.38 5.66 3.77 16.98 1.89
30_35 LB 65.22 15.22 63.04 8.70 6.52 14.13 1.09
30_35 Bumpy 0.00 0.00 0.00 0.00 0.00 0.00 0.00
30_35 BL516 54.96 21.37 55.73 1.53 7.63 30.53 3.05
30_35 Hass 66.84 16.84 67.89 2.63 11.05 5.79 2.11
30_35 Junior 58.87 32.62 50.35 10.64 9.93 9.93 0.71
30_35 GEM 60.95 27.62 53.33 6.67 3.81 28.57 2.86
30_35 EG 0.00 0.00 0.00 0.00 0.00 0.00 0.00
>35 LB 0.00 0.00 0.00 0.00 0.00 0.00 0.00
>35 Bumpy 0.00 0.00 0.00 0.00 0.00 0.00 0.00
>35 BL516 0.00 0.00 0.00 0.00 0.00 0.00 0.00
>35 Hass 0.00 33.33 33.33 0.00 33.33 0.00 0.00
>35 Junior 69.62 24.05 58.23 6.33 12.66 3.80 1.27
>35 GEM 51.22 26.83 60.98 9.76 9.76 24.39 0.00
>35 EG 0.00 0.00 0.00 0.00 0.00 0.00 0.00
;
run;
proc sort data=wide out=long;
by DM_range Variety ;
run;
/* Transpose texture */
proc transpose data=long name=texture_label out=long1(rename=(COL1 = texture_value) );
by DM_range Variety ;
var a_texture b_texture c_texture d_texture e_texture f_texture g_texture;
run;
PROC PRINT DATA=long1 ;
RUN ;
/*rename levels if variable texture*/
data longnew;
set long1;
if texture_label = 'a_texture' then texture_label = 'Creamy';
else if texture_label = 'b_texture' then texture_label = 'Mushy';
else if texture_label = 'c_texture' then texture_label = 'Smooth';
else if texture_label = 'd_texture' then texture_label = 'Stringy';
else if texture_label = 'e_texture' then texture_label = 'Dry';
else if texture_label = 'f_texture' then texture_label = 'Watery';
else if texture_label = 'g_texture' then texture_label = 'None';
run;
PROC PRINT DATA=longnew ;
RUN ;
/* use this code to remove old grseg entries when running the code more than once
proc greplay igout=work.gseg nofs;
delete _all_;
run; quit;
*/
goptions reset=all cback=white border htext=12pt hsize=3in vsize=5in nodisplay;
goptions ctext=gray20;
axis1 color=grayde order=(0 to 100 by 25) ;
title h=12pt 'Comparison of texture among varieties';
title2 h=12pt 'at DM <15 (relative %)';
proc gradar data=longnew;
where DM_range = '<15' and Variety in ('I49L', 'I55B');
chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
overlay=Variety NOLEGEND
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
spiderweb
noframe
starcircles=(25 50)
cstarcircles=black
cstars=(aqua fuchsia blue)
wstars=(2 2 2)
lstar=(1 1 1)
cframe=white
;
run;
quit;
goptions reset=all cback=white border htext=12pt hsize=3in vsize=5in nodisplay;
goptions ctext=gray20;
axis1 color=grayde order=(0 to 100 by 25) ;
title1 j=c h=12pt 'Comparison of texture among varieties';
title2 j=c h=12pt 'at DM 15-20 (relative %)';
proc gradar data=longnew;
where DM_range = '15_20';
chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
overlay=Variety NOLEGEND
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
spiderweb
noframe
starcircles=(25 50)
cstarcircles=black
cstars=(aqua orange red green fuchsia blue)
wstars=(2 2 2 2 2 2 )
lstar=(1 1 1 1 1 1)
cframe=white
;
run;
quit;
goptions reset=all cback=white border htext=12pt hsize=3in vsize=5in nodisplay;
goptions ctext=gray20;
axis1 color=grayde order=(0 to 100 by 25) ;
title1 j=c h=12pt 'Comparison of texture among varieties';
title2 j=c h=12pt 'at DM 20-25 (relative %)';
proc gradar data=longnew;
where DM_range = '20_25';
chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
overlay=Variety NOLEGEND
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
spiderweb
noframe
starcircles=(25 50)
cstarcircles=black
cstars=(aqua orange red green fuchsia lime blue)
wstars=(2 2 2 2 2 2 2)
lstar=(1 1 1 1 1 1 1)
cframe=white
;
run;
quit;
goptions reset=all cback=white border htext=12pt hsize=3in vsize=5in nodisplay;
goptions ctext=gray20;
axis1 color=grayde order=(0 to 100 by 25);
title1 j=c h=12pt 'Comparison of texture among varieties';
title2 j=c h=12pt 'at DM 25-30 (relative %)';
proc gradar data=longnew;
where DM_range = '25_30';
chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
overlay=Variety NOLEGEND
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
spiderweb
noframe
starcircles=(25 50)
cstarcircles=black
cstars=(aqua orange red green fuchsia lime blue)
wstars=(2 2 2 2 2 2 2)
lstar=(1 1 1 1 1 1 1)
cframe=white
;
run;
quit;
goptions reset=all cback=white border htext=12pt hsize=3in vsize=5in nodisplay;
goptions ctext=gray20;
axis1 color=grayde order=(0 to 100 by 25) ;
title1 j=c h=12pt 'Comparison of texture among varieties';
title2 j=c h=12pt 'at DM 30-35 (relative %)';
proc gradar data=longnew;
where DM_range = '30_35';
chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
overlay=Variety NOLEGEND
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
spiderweb
noframe
starcircles=(25 50)
cstarcircles=black
cstars=(aqua orange red fuchsia lime)
wstars=(2 2 2 2 2)
lstar=(1 1 1 1 1)
cframe=white
;
run;
quit;
goptions reset=all cback=white border htext=12pt hsize=3in vsize=5in nodisplay;
goptions ctext=gray20;
axis1 color=grayde order=(0 to 100 by 25) ;
title1 j=c h=12pt 'Comparison of texture among varieties';
title2 j=c h=12pt 'at DM >35 (relative %)';
proc gradar data=longnew;
where DM_range = '>35';
chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
overlay=Variety NOLEGEND
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
spiderweb
noframe
starcircles=(25 50)
cstarcircles=black
cstars=(orange red lime )
wstars=(2 2 2)
lstar=(1 1 1)
cframe=white
;
run;
quit;
goptions reset=all;
proc greplay igout=work.gseg nofs tc=work.templt;
tdef R2C3
1/llx=0 lly=50 ulx=0 uly=100 urx=33 ury=100 lrx=33 lry=50
2/llx=33 lly=50 ulx=33 uly=100 urx=66 ury=100 lrx=66 lry=50
3/llx=66 lly=50 ulx=66 uly=100 urx=99 ury=100 lrx=99 lry=50
4/llx=0 lly=0 ulx=0 uly=50 urx=33 ury=50 lrx=33 lry=0
5/llx=33 lly=0 ulx=33 uly=50 urx=66 ury=50 lrx=66 lry=0
6/llx=66 lly=0 ulx=66 uly=50 urx=99 ury=50 lrx=99 lry=0
;
template R2C3;
treplay 1:1 2:2 3:3
4:4 5:5 6:6;
run;
quit;
Thank you so much for helping me with this Marcia! I tried the code and got all the graphs in one panel. I noticed however that the attributes (creamy, watery, etc) in the axis are almost impossible to see. Is there a way to make them bigger like in the second picture? I tried increasing the number in htext=18pt but it didn't work.
data wide;
length DM_range $10;
length Variety $10;
input DM_range $ Variety $ a_texture b_texture c_texture d_texture e_texture f_texture g_texture;
if Variety='LB' then Variety='I49L';
if Variety='Junior' then Variety='I54J';
if Variety='Bumpy' then Variety='I55B';
if Variety='EG' then Variety='I12E';
datalines;
<15 LB 50.00 50.00 66.67 0.00 0.00 50.00 0.00
<15 Bumpy 17.07 31.71 34.15 7.32 0.00 82.93 0.00
<15 BL516 0.00 50.00 25.00 0.00 25.00 50.00 0.00
<15 Hass 0.00 0.00 0.00 0.00 0.00 0.00 0.00
<15 Junior 0.00 0.00 0.00 0.00 0.00 0.00 0.00
<15 GEM 0.00 0.00 0.00 0.00 0.00 0.00 0.00
<15 EG 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15_20 LB 31.52 23.91 33.70 19.57 9.78 51.09 2.17
15_20 Bumpy 18.09 15.96 38.30 8.51 2.13 81.91 1.06
15_20 BL516 10.71 30.36 12.50 23.21 1.79 75.00 5.36
15_20 Hass 43.15 24.32 44.52 6.16 5.48 44.18 2.05
15_20 Junior 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15_20 GEM 19.05 33.33 28.57 9.52 0.00 85.71 4.76
15_20 EG 50.68 23.29 52.05 4.11 1.37 50.68 0.00
20_25 LB 24.73 19.35 40.86 12.90 5.38 48.39 5.38
20_25 Bumpy 32.35 24.71 37.06 7.06 4.71 52.35 2.35
20_25 BL516 26.42 24.53 29.25 2.83 0.94 69.81 3.77
20_25 Hass 47.31 21.51 45.52 6.81 6.81 30.11 3.58
20_25 Junior 49.30 32.39 43.66 16.90 5.63 30.99 1.41
20_25 GEM 20.00 28.00 20.00 6.67 0.00 84.00 0.00
20_25 EG 72.56 31.10 60.98 3.66 1.83 22.56 2.44
25_30 LB 48.33 13.33 51.67 23.33 3.33 26.67 3.33
25_30 Bumpy 25.00 19.44 47.22 0.00 8.33 58.33 2.78
25_30 BL516 34.15 22.93 42.93 7.32 2.44 44.88 3.41
25_30 Hass 61.84 21.71 55.92 6.14 7.68 11.40 2.63
25_30 Junior 60.56 28.33 40.56 5.56 6.11 26.11 2.78
25_30 GEM 59.38 18.75 53.13 0.00 6.25 31.25 6.25
25_30 EG 75.47 26.42 60.38 5.66 3.77 16.98 1.89
30_35 LB 65.22 15.22 63.04 8.70 6.52 14.13 1.09
30_35 Bumpy 0.00 0.00 0.00 0.00 0.00 0.00 0.00
30_35 BL516 54.96 21.37 55.73 1.53 7.63 30.53 3.05
30_35 Hass 66.84 16.84 67.89 2.63 11.05 5.79 2.11
30_35 Junior 58.87 32.62 50.35 10.64 9.93 9.93 0.71
30_35 GEM 60.95 27.62 53.33 6.67 3.81 28.57 2.86
30_35 EG 0.00 0.00 0.00 0.00 0.00 0.00 0.00
>35 LB 0.00 0.00 0.00 0.00 0.00 0.00 0.00
>35 Bumpy 0.00 0.00 0.00 0.00 0.00 0.00 0.00
>35 BL516 0.00 0.00 0.00 0.00 0.00 0.00 0.00
>35 Hass 0.00 33.33 33.33 0.00 33.33 0.00 0.00
>35 Junior 69.62 24.05 58.23 6.33 12.66 3.80 1.27
>35 GEM 51.22 26.83 60.98 9.76 9.76 24.39 0.00
>35 EG 0.00 0.00 0.00 0.00 0.00 0.00 0.00
;
run;
proc sort data=wide out=long;
by DM_range Variety ;
run;
/* Transpose texture */
proc transpose data=long name=texture_label out=long1(rename=(COL1 = texture_value) );
by DM_range Variety ;
var a_texture b_texture c_texture d_texture e_texture f_texture g_texture;
run;
/*rename levels if variable texture*/
data longnew;
set long1;
if texture_label = 'a_texture' then texture_label = 'Creamy';
else if texture_label = 'b_texture' then texture_label = 'Mushy';
else if texture_label = 'c_texture' then texture_label = 'Smooth';
else if texture_label = 'd_texture' then texture_label = 'Stringy';
else if texture_label = 'e_texture' then texture_label = 'Dry';
else if texture_label = 'f_texture' then texture_label = 'Watery';
else if texture_label = 'g_texture' then texture_label = 'None';
run;
options nodate nonumber;
options leftmargin="0.001in" rightmargin="0.001in" topmargin="0.001in" bottommargin="0.001in";
options papersize=(10.0in 7.0in);
ods printer printer=png300 file="c:\temp\dashboard.png" style=normalprinter;
ods layout gridded columns=3 advance=proc
column_gutter=0.1in row_gutter=0.1in;
goptions reset=all cback=white border htitle=8pt htext=8pt vsize=3in hsize=3in ;
goptions ctext=gray20;
axis1 color=grayde order=(0 to 100 by 25) ;
title1 j=c h=8pt 'Comparison of texture among varieties at DM <15 (relative %)';
proc gradar data=longnew;
where DM_range = '<15' and Variety in ('I49L', 'I55B');
chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
overlay=Variety NOLEGEND
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
spiderweb
noframe
starcircles=(25 50)
cstarcircles=black
cstars=(aqua fuchsia blue)
wstars=(2 2 2)
lstar=(1 1 1)
cframe=white
;
run;
quit;
goptions reset=all cback=white border htitle=8pt htext=8pt vsize=3in hsize=3in ;
goptions ctext=gray20;
axis1 color=grayde order=(0 to 100 by 25) ;
title1 j=c h=8pt 'Comparison of texture among varieties at DM 15-20 (relative %)';
proc gradar data=longnew;
where DM_range = '15_20';
chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
overlay=Variety NOLEGEND
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
spiderweb
noframe
starcircles=(25 50)
cstarcircles=black
cstars=(aqua orange red green fuchsia blue)
wstars=(2 2 2 2 2 2 )
lstar=(1 1 1 1 1 1)
cframe=white
;
run;
quit;
goptions reset=all cback=white border htitle=8pt htext=8pt vsize=3in hsize=3in ;
goptions ctext=gray20;
axis1 color=grayde order=(0 to 100 by 25) ;
title1 j=c h=8pt 'Comparison of texture among varieties at DM 20-25 (relative %)';
proc gradar data=longnew;
where DM_range = '20_25';
chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
overlay=Variety NOLEGEND
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
spiderweb
noframe
starcircles=(25 50)
cstarcircles=black
cstars=(aqua orange red green fuchsia lime blue)
wstars=(2 2 2 2 2 2 2)
lstar=(1 1 1 1 1 1 1)
cframe=white
;
run;
quit;
goptions reset=all cback=white border htitle=8pt htext=8pt vsize=3in hsize=3in ;
goptions ctext=gray20;
axis1 color=grayde order=(0 to 100 by 25);
title1 j=c h=8pt 'Comparison of texture among varieties at DM 25-30 (relative %)';
proc gradar data=longnew;
where DM_range = '25_30';
chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
overlay=Variety NOLEGEND
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
spiderweb
noframe
starcircles=(25 50)
cstarcircles=black
cstars=(aqua orange red green fuchsia lime blue)
wstars=(2 2 2 2 2 2 2)
lstar=(1 1 1 1 1 1 1)
cframe=white
;
run;
quit;
goptions reset=all cback=white border htitle=8pt htext=8pt vsize=3in hsize=3in ;
goptions ctext=gray20;
axis1 color=grayde order=(0 to 100 by 25) ;
title1 j=c h=8pt 'Comparison of texture among varieties at DM 30-35 (relative %)';
proc gradar data=longnew;
where DM_range = '30_35';
chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
overlay=Variety NOLEGEND
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
spiderweb
noframe
starcircles=(25 50)
cstarcircles=black
cstars=(aqua orange red fuchsia lime)
wstars=(2 2 2 2 2)
lstar=(1 1 1 1 1)
cframe=white
;
run;
quit;
goptions reset=all cback=white border htitle=8pt htext=8pt vsize=3in hsize=3in ;
goptions ctext=gray20;
axis1 color=grayde order=(0 to 100 by 25) ;
title1 j=c h=8pt 'Comparison of texture among varieties at DM >35 (relative %)';
proc gradar data=longnew;
where DM_range = '>35';
chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
overlay=Variety NOLEGEND
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
spiderweb
noframe
starcircles=(25 50)
cstarcircles=black
cstars=(orange red lime )
wstars=(2 2 2)
lstar=(1 1 1)
cframe=white
;
run;
quit;
ods layout end;
ods printer close;
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.
Ready to level-up your skills? Choose your own adventure.