BookmarkSubscribeRSS Feed
gzr2mz39
Quartz | Level 8
How do I increase the font-size of the datalabels (ie inj_yr)?
Thank you.

proc sgplot data=nu2s description="Plot";
band x=cnt upper=emp_upper lower=emp_lower /
transparency=.655 group=category name="bmi";
xaxis min=5 max=50 label='Injury' grid;
yaxis min=50 max=250 label='# Employees' grid;
keylegend "bmi" / position=bottomright location=outside across=4 title='Rate: ';
series x=inj_non y=emp_non / datalabel=inj_yr lineattrs=(pattern=solid thickness=2px)
markerattrs=(symbol=circlefilled ) markers group=job_class name="pts";
6 REPLIES 6
DanH_sas
SAS Super FREQ
Currently, you can only do it through an ODS style. You can create a small style that inherits from the style you're using but only adjusts the datalabel font size. Here is an example:

[pre]
proc template;
define style styles.mystyle;
parent=styles.listing;
style GraphDataText from GraphDataText /
fontsize=9pt;
end;
run;
[/pre]

Then, you can set STYLE=MYSTYLE on the ODS destination statement and you should see the size increase. Let me know if you have any problems.

Thanks!
Dan
gzr2mz39
Quartz | Level 8
How do I combine mystyle with the style below:

proc template;
define style styles.rate;
parent=styles.analysis;
style graphcolors from graphcolors /
'gdata1'=MOYG
'gdata2'=STY
'gdata3'=BILG
'gdata4'=LILG
'gdata5'=VLIBG
'gdata6'=VIPK
'gdata7'=VIYPK
'gdata8'=LIRP;
'gdata9'=LIV;
end;quit;
DanH_sas
SAS Super FREQ
Just add the GraphDataText to your style:

[pre]
proc template;
define style styles.rate;
parent=styles.analysis;
style graphcolors from graphcolors /
'gdata1'=MOYG
'gdata2'=STY
'gdata3'=BILG
'gdata4'=LILG
'gdata5'=VLIBG
'gdata6'=VIPK
'gdata7'=VIYPK
'gdata8'=LIRP
'gdata9'=LIV;

style GraphDataText from GraphDataText /
fontsize = 9pt;
end;
quit;
[/pre]
GraphGuy
Meteorite | Level 14
And, for the sake of those that might be wondering how to do this with traditional "proc gplot" ...


symbol1 value=dot interpol=none pointlabel=("#name" height=1.5pct);

proc gplot data=sashelp.class;
plot height*age=1;
run;
Gunter
Calcite | Level 5
Hi,
I tried this solution for a similar problem but it dosn't work for me.
I would like to increase the resolution of my graph-output. Therefor, I increased width and hight in the ods graphics statement. Unfortunately the font size stayed at the same size.

It would be nice, if someone could help my finding a way to get a bigger font size!

Thanks in advance!

Gunter

Here is my code:

/*Plots der Verteilungen*/
proc template;
define style styles.bigtext;
parent=styles.listing;
style GraphValueText from GraphValueText /
fontsize=20pt
;
end;
run;
ods html gpath='H:\SAS\zw\bilder' style=bigtext ;
ods graphics / reset=all width=1100px height=300px border=off style=bigtext;

proc template;
define statgraph sgscatter_gunter2;

begingraph / includeMissingDiscrete=true;
EntryTitle "" /;
layout lattice / pad=(top=3) rowgutter=10 columngutter=10 columns=4 columnDataRange=data rowDataRange=union columndatarange=union ;
ColumnAxes;
ColumnAxis / displaysecondary=none griddisplay=off offsetmin=0.05 offsetmax=0.05 linearopts=(viewmin=0 viewmax=20);
ColumnAxis / displaysecondary=none griddisplay=off offsetmin=0.05 offsetmax=0.05 linearopts=(viewmin=0 viewmax=10);
ColumnAxis / displaysecondary=none griddisplay=off offsetmin=0.05 offsetmax=0.05 linearopts=(viewmin=0 viewmax=10);
ColumnAxis / displaysecondary=none griddisplay=off offsetmin=0.05 offsetmax=0.05 linearopts=(viewmin=0 viewmax=140);
EndColumnAxes;

RowAxes;
EndRowAxes;
histogram diag2 /xvalues=midpoints binwidth=2 fillattrs=(color=lightgrey) ;
histogram anz2 / xvalues=midpoints binwidth=1 fillattrs=(color=lightgrey);
histogram xanz2 /xvalues=midpoints binwidth=1 fillattrs=(color=lightgrey);
histogram klasse2 /xvalues=midpoints binwidth=7 fillattrs=(color=lightgrey);
endlayout;
endgraph;
end;
run;
proc sgrender data=lak1_geneuto3
template=sgscatter_gunter2;
label anz2='ANZ' klasse2='DS' diag2='DIAG' xanz2='ANZ14';

run;
DanH_sas
SAS Super FREQ
Hey Gunter,

If the goal is to increase the graph resolution, use the IMAGE_DPI option on the ODS destination statement (for PRINTER or PDF, use the DPI option). If you are trying to do this with HTML output, I have found that browsers do not typically handle images higher than 100dpi very well. Let me know if this works out for you.

Thanks!
Dan

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 10897 views
  • 0 likes
  • 4 in conversation