- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to make a boxplot with scatter overlay that includes category and group. Boxplot turns out OK, but scatter is all lumped within category as shown. I can't find a statement for SCATTER that would separate the points by both category and by group.
proc sgplot data=mydata;
vbox velocity / category=site group=target;
scatter x=site y=velocity / jitter transparency=0.8 markerattrs=(color=black symbol=circle size=4);
yaxis type=log;
run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You need group and groupdisplay=cluster for the scatter plot, and may need to play with clusterwidth as well.
See this answer:
And this blog post:
https://blogs.sas.com/content/graphicallyspeaking/2015/12/23/box-plot-with-stat-table-and-markers/
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You need group and groupdisplay=cluster for the scatter plot, and may need to play with clusterwidth as well.
See this answer:
And this blog post:
https://blogs.sas.com/content/graphicallyspeaking/2015/12/23/box-plot-with-stat-table-and-markers/
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That blog is excellent.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You might try switching to SGPANEL with your SITE variable as the Panelby variable. Target would then be available as the Category for VBOX and the X variable for the scatter and as the Group variable.
Maybe something like:
proc sgpanel data=mydata; panelby site /columns=3; vbox velocity / category= target; scatter x=target y=velocity / group=target jitter transparency=0.8 markerattrs=( symbol=circle size=4); rowaxis type=log; run;
If this is close there are things that can be done with appearance options to remove dividing lines between panels and such. Do note that using target as group for scatter means you don't want to specify the color for the markers...