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

I have font stretching in the vertical axis as shown below. All values on the plot at stretched this way. I tried various sizes, reset graphics, set scale = off, nothing seems to work. What other options do I have?

How they do look:

_Hopper_1-1725632638982.png

How they should look

_Hopper_2-1725632675434.png

Code follows:


%macro figure_format1();
styleattrs datasymbols= (CircleFilled CircleFilled TriangleFilled TriangleFilled DiamondFilled DiamondFilled)
datacontrastcolors=(lipgr depk libgr vigb gray black)
datalinepatterns= (solid solid solid solid); *(dash solid dash solid);
legenditem type=markerline name="G4F" / label="Group4 FE"
lineattrs=(pattern=solid color=lipgr thickness=4)
markerattrs=(symbol=CircleFilled color=libgr size=9pt);
legenditem type=markerline name="G4S" / label="Group4 SE"
lineattrs=(pattern=solid color=depk thickness=4)
markerattrs=(symbol=CircleFilled color=depk size=9pt);
legenditem type=markerline name="G5F" / label="Group5 FE"
lineattrs=(pattern=solid color=libgr thickness=4)
markerattrs=(symbol=TriangleFilled color=libgr size=9pt);
legenditem type=markerline name="G5S" / label="Group5 SE"
lineattrs=(pattern=solid color=vigb thickness=4)
markerattrs=(symbol=TriangleFilled color=vigb size=9pt);
legenditem type=markerline name="G6F" / label="Group6 FE"
lineattrs=(pattern=solid color=gray thickness=4)
markerattrs=(symbol=DiamondFilled color=gray size=9pt);
legenditem type=markerline name="G6S" / label="Group6 SE"
lineattrs=(pattern=solid color=black thickness=4)
markerattrs=(symbol=DiamondFilled color=black size=9pt);
keylegend "G4S" "G4F" "G5S" "G5F" "G6S" "G6F" / title="";
%mend;

 


proc sgplot data=AVAL_mean NOAUTOLEGEND;
%figure_format1;
series x= MONTH y= MEAN / group= EYEFL LINEATTRS= (THICKNESS= 4);
scatter x= MONTH y= MEAN / group= EYEFL markerattrs= (size= 9pt);
xaxis min=0 max= 36 VALUES= (0 to 24 by 6,36) VALUESHINT minor minorcount=1
LABELATTRS=(size=12pt) VALUEATTRS=(size=12pt);
yaxis VALUESHINT minor minorcount=1
LABELATTRS=(size=12pt) VALUEATTRS=(size=12pt);
xaxistable N / x=MONTH class=EYE_N classorder=descending
LABELATTRS=(size=9pt) VALUEATTRS=(size=9pt);
run;

 

Graphics options to start:

 


ods graphics /reset;
options printerpath = pdf;
option orientation=landscape;
ods graphics / AttrPriority=None; * to override default attributes (color, line type, and marker, etc);
ods graphics on / width=9in height=6.5in scale = off;

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Try these two things:

  1. Remove PRINTPATH (it's not needed)
  2. Instead of setting both WIDTH and HEIGHT, try setting just one of them. This will allow the graph to maintain its original aspect.

Let us know if that works.

View solution in original post

7 REPLIES 7
DanH_sas
SAS Super FREQ

A couple of questions:

  1. In what environment are running (e.g. EG, SAS Studio, DisplayManager, batch)?
  2. I see you setting the printer path, but which output destination are you using?
_Hopper
Obsidian | Level 7

Environment is Windows 11 PC Install

 

Output destination is PDF.

_Hopper
Obsidian | Level 7

I think I may have found a solution.

 

Add the png device and give it an imagename

 

option orientation=landscape device = png;
ods graphics / imagename='Swimmer_93' AttrPriority=None;

DanH_sas
SAS Super FREQ

The image approach should work, but try the other I mentioned as well. If it works, it will allow you to keep vector-based output, which tends to be sharper and create smaller PDF files.

DanH_sas
SAS Super FREQ

For the image approach, you should set the output type on the ODS GRAPHICS statement, not on the DEVICE option (even though it worked). The OUTPUTFMT option is the supported way to specify the output type for ODS Graphics output. The IMAGENAME is not required here, as the image is embedded in the PDF file:

 

ods graphics / outputfmt=png;

DanH_sas
SAS Super FREQ

Try these two things:

  1. Remove PRINTPATH (it's not needed)
  2. Instead of setting both WIDTH and HEIGHT, try setting just one of them. This will allow the graph to maintain its original aspect.

Let us know if that works.

_Hopper
Obsidian | Level 7

Dan,

 

It appears to work fine. However, I need to keep the image option otherwise the fonts do not render correctly.

 

Thanks for your help!

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 7 replies
  • 1396 views
  • 0 likes
  • 2 in conversation