Dear All,
I would like to seek your help on adjusting the X-axis tickvalues direction in order to add space between month 30 (in column 1) and Baseline (in column 2).
Jack
PROC TEMPLATE;
define statgraph time_pro_lattice;
begingraph /designwidth=40in designheight=15in ;
dynamic _x _y1 _y2 _title _footnote _group _ymean _ymean2 _LCI _UCI _LCI2 _UCI2;
entrytitle _title
entryfootnote _footnote;
layout lattice/columns=2 rows=1 order=columnmajor rowdatarange=UNIONALL columndatarange=UNION columngutter=2.5cm;
/*DEFINE THE FIRST CELL*/
cell;
cellheader;
entry "Left Eye"/border=FALSE;
endcellheader;
layout overlay;
scatterplot x=_x y=_y1/group=_group
xaxis=x
yaxis=y
markerattrs=(color=black);
scatterplot x=_x y=_ymean;
scatterplot x=_x y=_lci;
scatterplot x=_x y=_uci;
seriesplot x=_x y=_ymean/lineattrs=(pattern=solid color=red) name="ps1" legendlabel="Mean of CS Left";
seriesplot x=_x y=_lci/lineattrs=(pattern=dot color=pink) name="ps2" legendlabel="Lower 90% CI limit";
seriesplot x=_x y=_uci/lineattrs=(pattern=dot color=pink) name="ps3" legendlabel="Upper 90% CI limit";
endlayout;
endcell;
/**Define the 2nd Cell**/
cell;
cellheader;
entry "Rigth Eye"/border=FALSE;
endcellheader;
layout overlay;
scatterplot x=_x y=_y2/xaxis=x yaxis=y group=_group
/*colorresponse=_y2*/
markerattrs=(color=black);
scatterplot x=_x y=_ymean2;
scatterplot x=_x y=_lci2;
scatterplot x=_x y=_uci2;
;
seriesplot x=_x y=_ymean2/lineattrs=(pattern=solid color=red) name="ps4" legendlabel="Mean of CS Right";
seriesplot x=_x y=_lci2/lineattrs=(pattern=dot color=yellow) name="ps5" legendlabel="Lower 90% CI limit Right";
seriesplot x=_x y=_uci2/lineattrs=(pattern=dot color=yellow) name="ps6" legendlabel="Upper 90% CI limit Right";
endlayout;
endcell;
/*define the axis attributes**/
columnaxes;
columnaxis/display=(ticks tickvalues label) label="Visit (month)" labelattrs=(color=blue)
linearopts=(tickvaluefitpolicy=ROTATE tickvaluerotation=DIAGONAL tickvaluelist=(2 3 3.5 4 4.5 5 6 7 7.5)) griddisplay=ON name="column"
;
columnaxis/display=(ticks tickvalues label) label="Visit (month)" labelattrs=(color=green)
linearopts=( tickvaluefitpolicy=ROTATE tickvaluerotation=DIAGONAL tickvaluelist=(2 3 3.5 4 4.5 5 6 7 7.5)) griddisplay=ON name="column"
;
endcolumnaxes;
rowaxes;
rowaxis/display=(ticks tickvalues label) label="Contrast Sensitivity" griddisplay=ON name="row";
rowaxis/display=(ticks tickvalues label) label="Contrast Sensitivity" griddisplay=ON;
endrowaxes;
/***Specify how to define the legend to be displayed***/
sidebar/align=bottom;
discretelegend "ps1" "ps2" "ps3" "ps4" "ps5" "ps6"/border=FALSE;
endsidebar;
endlayout;
endgraph;
end;
run;
Hi,
The gap could be increased with columgutter. If you don't want to increase this gap to avoid lose space. Also you could try to add the option TICKVALUEFITPOLICY= ROTATEALWAYS to try to force to rotate. I think that only can be used in versions 9.4.
Hi,
The gap could be increased with columgutter. If you don't want to increase this gap to avoid lose space. Also you could try to add the option TICKVALUEFITPOLICY= ROTATEALWAYS to try to force to rotate. I think that only can be used in versions 9.4.
I believe suggestion by Rodriguez would work. Alternatively, you could set the xaxis offsetmax for the left cell and offsetmin for the 2nd right cell to push the markers furthur into each cell. Personally, I do not prefer rotated tick values, but that would work. Another way would be to allow tick value splitting by setting the TickValueFitPolicy. In that case you would have to provide whitespace for "Month 30". All the Month values will get split.
Hi Sanjay,
Yes you are absolutely right. I am really pleased to see your point on this question.
Jack
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.