Data visualization with SAS programming

How could I change the X axis tickvalues direction in Layout LATTICE in GTL?

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 86
Accepted Solution

How could I change the X axis tickvalues direction in Layout LATTICE in GTL?

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;

Accepted Solutions
Solution
‎07-04-2016 09:41 PM
Frequent Contributor
Posts: 142

Re: How could I change the X axis tickvalues direction in Layout LATTICE in GTL?

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.

 

View solution in original post


All Replies
Solution
‎07-04-2016 09:41 PM
Frequent Contributor
Posts: 142

Re: How could I change the X axis tickvalues direction in Layout LATTICE in GTL?

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.

 

Frequent Contributor
Posts: 86

Re: How could I change the X axis tickvalues direction in Layout LATTICE in GTL?

Really thanks for your quick and professional advice. The problem is resolved.
SAS Super FREQ
Posts: 1,044

Re: How could I change the X axis tickvalues direction in Layout LATTICE in GTL?

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.

Frequent Contributor
Posts: 86

Re: How could I change the X axis tickvalues direction in Layout LATTICE in GTL?

Hi Sanjay,

 

Yes you are absolutely right. I am really pleased to see your point on this question.

 

Jack

Post a Question
Discussion Stats
  • 4 replies
  • 336 views
  • 1 like
  • 3 in conversation