11-15-2017 10:12 AM
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.
11-15-2017 10:36 AM
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.
11-15-2017 10:39 AM
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.
11-15-2017 10:54 AM
however....is there a simple way to get the legend to match the connected lines without adding the series plot?
I'd tried the type=linepattern on the discretelegend but that gave the solid lines again?
11-15-2017 12:11 PM
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.
Need further help from the community? Please ask a new question.