- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I'm trying to find the posibility to create a scatter plot graph with many labels that can be adjusted manually. I know that using SAS Graph Template Language we can create a scatter plot with auto adjustment on the labels, and I'm quite pleased with this, but just in case if the labels are still too closed and overlapped I would have the capability to adjust it manually too. Is it possible to do this? I heard activeX graph will be deprecated and ODS Graphics Editor too.
Thank you in advance!
Here is the sample graph
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure where the final destination is for your graph, but here is one way to do it. First, generate your output using the ODS WORD destination. Here is an example:
ods _all_ close;
ods word file="class.docx";
ods graphics / outputfmt=svg;
proc sgplot data=sashelp.class;
scatter x=weight y=height / datalabel=name;
run;
ods _all_ close;
Next, open the file in Microsoft Word. Right-click on the graph and select, "Convert to Shape". You can then edit and move your labels. Then, deselect the graph, right-click on it, and select, "Save as Picture". This image will external save your edits as a PNG image.
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Try datalabel= option, that would avoid to overlap the two closed label .
proc sgplot data=sashelp.class;
scatter x=weight y=height/group=sex datalabel=name;
run;
As you can see there is no overlapped label , sas just do it for you .
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks! I know this one, but I'm looking a way to make it interactive, that we can adjust the labels manually by drag and drop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
On the ODS GRAPHICS statement, there is an option called LABELPOSITION that contains two fitting algorithms: GREEDY and SA (simulated annealing). The default is GREEDY, which works pretty well. However, if you have cases where GREEDY does not produce what you want, try SA. The graph might take a little longer to produce, but it might give you better results in some dense cases.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Dan! that's good to know. But I'm looking a way to make it interactive that I can adjust the labels manually after that by drag and drop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure where the final destination is for your graph, but here is one way to do it. First, generate your output using the ODS WORD destination. Here is an example:
ods _all_ close;
ods word file="class.docx";
ods graphics / outputfmt=svg;
proc sgplot data=sashelp.class;
scatter x=weight y=height / datalabel=name;
run;
ods _all_ close;
Next, open the file in Microsoft Word. Right-click on the graph and select, "Convert to Shape". You can then edit and move your labels. Then, deselect the graph, right-click on it, and select, "Save as Picture". This image will external save your edits as a PNG image.
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content