BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Adie_efc
Calcite | Level 5

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.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

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

6 REPLIES 6
Jay54
Meteorite | Level 14

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.

Adie_efc
Calcite | Level 5

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.

Jay54
Meteorite | Level 14

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

Adie_efc
Calcite | Level 5

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

Adie_efc
Calcite | Level 5

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?

Jay54
Meteorite | Level 14

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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