I have a box and whisker plot whereby I want the boxes to be solid but the lines joined at the median to differentiate between the treatment to be different line types.
When I ran this in 9.3 the legend gave me the correct colours and the correct line types. However when I run this in 9.4 I get solid lines (presumably because Ive set the boxes to be solid).
Ok I thought, I'll calculate these and do a series plot and use that for the legend. The issue I have is that the boxes are jittered slightly around the bottom axis and the series plot joins at the specific point.
Ive replicated the code using SASHELP.cars and attached both the 9.3 and 9.4 outputs.
When you use unfilled box, the line patterns of the box are included in the legend. Since you set those to PATTERN=1, all the lines in the legend are solid. But, the connect line uses CONNECTATTRS, which is not set. So, you get the patterned lines in the graph. To get solid lines for connect, use CONNECTATTRS=(pattern=1) in VBOX.
Thanks for the quick reply. I don't want solid lines connecting the medians, I want the legend to show patterned lines to match the connecting lines rather than solid. this is what you got with 9.3 but don't get with 9.4.
that's why I added the series plot to connect them and hence use as the legend. However, they don't join in the correct place.
For Box Plot, if the boxes are filled, the legend will display the fill color. If using NOFILL, then the legend will display the lines of the box outlines. You can set the TYPE option on the Legend to display fill, line or markers. Connect line is never displayed in the legend since is not used very often.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.