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

Hi there,

 

When I use y2axis in sgplot, the label for the entire y2axis is rotated counterclockwise, just like the yaxis.  I would like this label to instead be rotated clockwise.  Is this possible?

 

Kastchei_0-1585868328561.png

Warm regards,

Michael

1 ACCEPTED SOLUTION

Accepted Solutions
RichardDeVen
Barite | Level 11

There are no options in SGPLOT or attributes in Graphics Template Language (GTL) that surface a feature for rotating the axis label. 

You can customize the plot by specify a blank label and using annotation data to draw your own text at the point where a label should be with the rotation angle desired.

 

Example:

ods html file='plot.html';

* annotation data for drawing text for the label at x=110% of the data range and implicit y=50%;
* with the desired text render direction of rotation 270 (aka -90);
* 110% puts the text anchor point just beyond the axes tick mark labels;

data y2axis_anno; function = "text"; label = "Height"; rotate = 270; x1 = 110; drawspace = 'datapercent';
OUTPUT; run; proc sgplot data=sashelp.class sganno=y2axis_anno; series x=name y=age; series x=name y=height / y2axis; yaxis max=20; y2axis min=30 label=" "; %* Blank label; run;

Output

anno.png

 

View solution in original post

2 REPLIES 2
RichardDeVen
Barite | Level 11

There are no options in SGPLOT or attributes in Graphics Template Language (GTL) that surface a feature for rotating the axis label. 

You can customize the plot by specify a blank label and using annotation data to draw your own text at the point where a label should be with the rotation angle desired.

 

Example:

ods html file='plot.html';

* annotation data for drawing text for the label at x=110% of the data range and implicit y=50%;
* with the desired text render direction of rotation 270 (aka -90);
* 110% puts the text anchor point just beyond the axes tick mark labels;

data y2axis_anno; function = "text"; label = "Height"; rotate = 270; x1 = 110; drawspace = 'datapercent';
OUTPUT; run; proc sgplot data=sashelp.class sganno=y2axis_anno; series x=name y=age; series x=name y=height / y2axis; yaxis max=20; y2axis min=30 label=" "; %* Blank label; run;

Output

anno.png

 

Kastchei
Pyrite | Level 9

Thank you!

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

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
  • 1239 views
  • 5 likes
  • 2 in conversation