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?
Warm regards,
Michael
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
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
Thank you!
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.
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.
Ready to level-up your skills? Choose your own adventure.