BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jack2012
Obsidian | Level 7

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;
1 ACCEPTED SOLUTION

Accepted Solutions
arodriguez
Lapis Lazuli | Level 10

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

4 REPLIES 4
arodriguez
Lapis Lazuli | Level 10

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.

 

Jack2012
Obsidian | Level 7
Really thanks for your quick and professional advice. The problem is resolved.
Jay54
Meteorite | Level 14

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.

Jack2012
Obsidian | Level 7

Hi Sanjay,

 

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

 

Jack

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1785 views
  • 1 like
  • 3 in conversation