Data visualization with SAS programming

vbox joining of lines

Accepted Solution Solved
Reply
Contributor
Posts: 28
Accepted Solution

vbox joining of lines

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.

 

 

 

 


Accepted Solutions
Solution
a month ago
SAS Super FREQ
Posts: 1,183

Re: vbox joining of lines

To make the SERIES join in the correct place with the grouped boxes, use GROUPDISPLAY=CLUSTER in the SERIES statement.

View solution in original post


All Replies
SAS Super FREQ
Posts: 1,183

Re: vbox joining of lines

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.

Contributor
Posts: 28

Re: vbox joining of lines

Posted in reply to Sanjay_SAS

Hi Sanjay

 

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.

 

Thanks

 

Adie.

Solution
a month ago
SAS Super FREQ
Posts: 1,183

Re: vbox joining of lines

To make the SERIES join in the correct place with the grouped boxes, use GROUPDISPLAY=CLUSTER in the SERIES statement.

Contributor
Posts: 28

Re: vbox joining of lines

Posted in reply to Sanjay_SAS

perfect....thank you! I knew there must be a simple solution.

Contributor
Posts: 28

Re: vbox joining of lines

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?

SAS Super FREQ
Posts: 1,183

Re: vbox joining of lines

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.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 115 views
  • 0 likes
  • 2 in conversation