Hi! Hopefully my formating works this time! I'm creating a mirror butterfly plot and would like to change the color of the values in the bar segments to white for the segments with a black or maroon background. The remaining segments (VLIGB, red, and blue), I'd like to keep the text in black. I'd also like to change the fonts for the entire plot to Arial. The figure itself is working as intended just not these two aspects. Thank you in advance for your help! Sample Data: data WORK.DIAGNOSES;
infile datalines dsd truncover;
input diagnosis:$17. _2:32. _1:32. group_cat:32. group:$7.;
label diagnosis="diagnosis" _2="_2" _1="_1" group_cat="group_cat" group="group";
datalines;
ALL 52 -52 1 Group 1
ALL 2 -2 2 Group 2
AML 10 -20 1 Group 1
AML 6 -10 2 Group 2
Breast Cancer 20 -13 2 Group 2
Breast Cancer 20 -9 1 Group 1
Breast Cancer 8 -3 3 Group 3
Colon Cancer 20 -30 1 Group 1
Lung Cancer 24 -17 1 Group 1
Stomach Cancer 7 -7 4 Group 4
Stomach Cancer 4 -4 3 Group 3
Skin Cancer 1 -1 4 Group 4
Skin Cancer 1 0 3 Group 3
Pancreatic Cancer 2 -2 3 Group 3
Prostate Cancer 2 0 5 Group 5 Sample Code: proc format;
picture positive
low -< 0 = "0000"
0 <- high = "0000";
run;
proc sgplot data = work.diagnoses noborder nowall;
styleattrs datacontrastcolors=(black) datacolors=(VLIGB red blue black maroon);
format _1 positive.;
format _2 positive.;
hbar diagnosis / response = _1 group = group groupdisplay = stack barwidth=0.9 grouporder=ascending
attrid = myid seglabel
seglabelfitpolicy = thin
seglabelattrs =(size = 9 color = black weight = bold)
name = "c1";
hbar diagnosis / response = _2 group = group groupdisplay = stack barwidth=0.9 grouporder=ascending
seglabel
seglabelfitpolicy = thin
seglabelattrs = (size = 9 color = black weight = bold);
xaxis /*grid gridattrs = (pattern = solid) valueattrs = (size=10 weight = bold) */
labelattrs = (weight = bold) display=(noticks)
label = "Patients (%)" values = (-80 to 80 by 20);
yaxis
display = (noline nolabel noticks) discreteorder = data
valueattrs = (weight=bold color=black family="Arial" size=10)label="Patients";
keylegend "c1"/ across = 10 noborder title = '' valueattrs=(size=11) sortorder=ascending;
inset "Insert" / position = bottomleft
textattrs = (color = black size = 10 family="Arial"
style = normal);
inset "Insert" / position = bottomright
textattrs = (color = black size = 10 weight = bold family="Arial"
style = normal);
run;
... View more