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

Hi,all 🙂
I'm looking for a way to add margin (space / offset) between tick and tick label with proc gplot.
Even with the method in the case of "proc sgplot", it is ok, but we are seeking information with proc gplot as much as possible.
I attach an image if what I want to do.
Those who knows, thank you for your cooperation.

 

proc sgplot data=sashelp.class; 
 reg x=height y=weight; 
run;

output image of above code is

 

position_tick_label_gplot_sas.png

 

And what I want to do is below.

Check X axis label position.

position_tick_label_gplot_sas_margin.png

 

Have a fine day.

1 ACCEPTED SOLUTION

Accepted Solutions
ArtC
Rhodochrosite | Level 12

Here are three starter solutions.  Each could be refined depending on which way works best for you.

symbol v=dot color=blue;

* Solution #1;
axis1 order=(11 to 16)
      minor=none
      major=(height=10 color=white );
proc gplot data=sashelp.class;
   plot height*age/haxis=axis1;
   run;
   quit;

* Solution #2;
goptions reset=axis;
axis1 style=0;
axis2 order=(40 to 80 by 10)
      value=(t=1 color=white)
      minor=(n=1);
proc gplot data=sashelp.class;
   plot height*age/haxis=axis1
                   vaxis=axis2
                   vref=50;
   run;
   quit;

* Solution #3;
goptions reset=axis;
axis1 style=0;
axis2 offset=(10)
      minor=(n=1);
proc gplot data=sashelp.class;
   plot height*age/haxis=axis1
                   vaxis=axis2
                   vref=50;
   run;
   quit;

* Solution #4;
goptions reset=axis;
axis1 style=0;
axis2 style=0
      offset=(10)
      minor=(n=1);

data anno (keep=function xsys ysys x y line);
   retain xsys ysys '2' line 1 x 11;
   function='move';
      y=50; output anno;
   function='draw';
      y=80; output anno;
   run;

proc gplot data=sashelp.class
           anno=anno;
   plot height*age/haxis=axis1
                   vaxis=axis2
                   vref=50;
   run;
   quit;

View solution in original post

2 REPLIES 2
ArtC
Rhodochrosite | Level 12

Here are three starter solutions.  Each could be refined depending on which way works best for you.

symbol v=dot color=blue;

* Solution #1;
axis1 order=(11 to 16)
      minor=none
      major=(height=10 color=white );
proc gplot data=sashelp.class;
   plot height*age/haxis=axis1;
   run;
   quit;

* Solution #2;
goptions reset=axis;
axis1 style=0;
axis2 order=(40 to 80 by 10)
      value=(t=1 color=white)
      minor=(n=1);
proc gplot data=sashelp.class;
   plot height*age/haxis=axis1
                   vaxis=axis2
                   vref=50;
   run;
   quit;

* Solution #3;
goptions reset=axis;
axis1 style=0;
axis2 offset=(10)
      minor=(n=1);
proc gplot data=sashelp.class;
   plot height*age/haxis=axis1
                   vaxis=axis2
                   vref=50;
   run;
   quit;

* Solution #4;
goptions reset=axis;
axis1 style=0;
axis2 style=0
      offset=(10)
      minor=(n=1);

data anno (keep=function xsys ysys x y line);
   retain xsys ysys '2' line 1 x 11;
   function='move';
      y=50; output anno;
   function='draw';
      y=80; output anno;
   run;

proc gplot data=sashelp.class
           anno=anno;
   plot height*age/haxis=axis1
                   vaxis=axis2
                   vref=50;
   run;
   quit;
t_ar_taat
Quartz | Level 8
Hi,ArtC. Thank you very very much for your answering.It's so surprise that we have many ways for what I want on axis label !!

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 2360 views
  • 2 likes
  • 2 in conversation