Hi there,
I was using proc sgplot to make a scatter plot and wanted the fonts for both label and legend be Times New Roman, but it didn't work for the following code. All the other options of labelattrs such as weight, size, color worked. Any ideas about this?
ods graphics/reset imagename="AF" imagefmt=png;
Proc sgplot data=Model noborder ;
scatter x= AC y= FR/jitter jitterwidth=0.2 markerattrs=(size=5);
xaxis values=(0 to 7 by 1) label= " Rating by Rater1" labelattrs=(weight=bold size=14 family="Times New Roman" color=red);
yaxis values=(0 to 7 by 1) label= "Rating by Rater2" labelattrs=(weight=bold size=11 family="Times_New_Roman");
inset " P value < 0.0001"/position=top
textattrs=(size=12 weight=bold family="Times New Roman" color=red) noborder ;
run;
Thanks!
How to get PROC SGPLOT to convert all fonts to Times New Roman on PDF?
BR, Koen
You do not say where the font is not displaying correctly. Since your YAXIS statement spells the font differently I would not expect it to.
On my system using "Times New Roman" does work for the Axis statements using a different data set. I can't test your INSET as I am too lazy to completely fake such and you did not provide example data for the plot.
My code which uses a SAS supplied data set you should have to test the code. Since my values are different I do not attempt to use your values and used a different label so it is obvious that this is not your data.
Proc sgplot data=sashelp.class noborder ; scatter x= height y= weight/jitter jitterwidth=0.2 markerattrs=(size=5); xaxis label= "Student Height" labelattrs=(weight=bold size=14 family="Times New Roman" color=red); yaxis label= "Student Weight" labelattrs=(weight=bold size=11 family="Times New Roman"); ; run;
Depending on your system the font names might differ in details of the name used.
@Judy518 wrote:
Hi there,
I was using proc sgplot to make a scatter plot and wanted the fonts for both label and legend be Times New Roman, but it didn't work for the following code. All the other options of labelattrs such as weight, size, color worked. Any ideas about this?
ods graphics/reset imagename="AF" imagefmt=png;
Proc sgplot data=Model noborder ;
scatter x= AC y= FR/jitter jitterwidth=0.2 markerattrs=(size=5);
xaxis values=(0 to 7 by 1) label= " Rating by Rater1" labelattrs=(weight=bold size=14 family="Times New Roman" color=red);
yaxis values=(0 to 7 by 1) label= "Rating by Rater2" labelattrs=(weight=bold size=11 family="Times_New_Roman");
inset " P value < 0.0001"/position=top
textattrs=(size=12 weight=bold family="Times New Roman" color=red) noborder ;
run;
Thanks!
How to get PROC SGPLOT to convert all fonts to Times New Roman on PDF?
BR, Koen
Thank you all so much for your response.
The solution was to change "Times New Roman" to "Times New Roman Uni"
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.