BookmarkSubscribeRSS Feed
JonathanNitzan
Calcite | Level 5

Hi,

 

I’m trying to have GTL create an axis with BOTH major and minor tick marks shown INSIDE rather than outside the cell. This is the code I use to do so for the X-axis:

 

...
layout overlay/
xaxisopts=(offsetmin=0 offsetmax=0 display=(line ticks tickvalues) tickvalueattrs=(family='Arial' size=10px) tickstyle=inside
linearopts=(minorticks=true minortickcount=4 viewmin=1920 viewmax=2040 tickvaluesequence=(start=1920 end=2040 increment=10)))
...

 

According to the GTL Reference manual, the option <tickstyle=inside> should apply for both major and minor ticks. In practice, though, it applies only to the major ticks. The net result is that the major tick marks show inside the cell while the minor tick marks show outside the cell, as you can see here:

 

axis.jpg

 

I asked SAS for assistance and was informed that this is a bug in the program, and that this bug will be fixed only in a future release. It was also suggested that I use DRAWLINE to create the axis as I want it to show.

 

I’m not that good a programmer, so I wonder if anyone can think of a clever little loop to do so.

 

Much obliged,

Jonathan

5 REPLIES 5
GraphGuy
Meteorite | Level 14

I'm not sure about GTL, but here's one way to do it using annotated minor tick marks on a SGplot:

 

data anno_ticks;
function='line'; linepattern='solid'; linecolor='cx989ea1'; linethickness=1;
layer='front';
x1space='datavalue'; y1space='wallpercent';
x2space='datavalue'; y2space='wallpercent';
do x1 = 50 to 150 by 2;
  x2=x1;
  y1=0.3; output;
  y2=1.0; output;
  end;
run;

 

title "Sgplot, with annotated minor tick marks inside";
proc sgplot data=sashelp.class sganno=anno_ticks;
scatter x=weight y=height;
xaxis values=(50 to 150 by 10) tickstyle=inside offsetmin=0 offsetmax=0;
yaxis values=(50 to 75 by 5) offsetmin=0 offsetmax=0;
run;

 

inside_minor.png

JonathanNitzan
Calcite | Level 5
Thank you very much! I'll check it out.
DanH_sas
SAS Super FREQ

Use the TICKSTYLE option on the axis statements in SGPLOT.

DanH_sas
SAS Super FREQ

As a follow-up to my previous post, the TICKSTYLE option affects only the MAJOR tick marks. The solution proposed by @GraphGuy is probably the best option.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 3342 views
  • 1 like
  • 3 in conversation