I recently saw an interesting infographic (see partial screen-capture below) about the top 10 most annoying airline seatmate behaviors. But the infographic was one of those *long* spread out ones, that you have to scroll forever to see the whole thing. I decided to try to create a more efficient SAS graph to visualize the same data, so you can see all the information in one page, at a glance.
Not everyone is as fortunate as my buddy David (pictured below), who has a pilot license, and does not have to worry about annoying behaviors of random seatmates.
The rest of us non-pilots have to fly on commercial airlines, and the people sitting around us have a variety of behaviors - some good, and some annoying. Expedia's infographic about annoying seatmates was 'cute,' but I had to do so much scrolling to view the 1000x4515 pixel image that by the time I viewed the last few items, I had forgotten what the first few items were!
Therefore I decided to create a no-nonsense SAS graph that allows me to see and compare all the data, in a graph that easily fits on one page without scrolling. I first input the data into a SAS dataset, and then used the following minimal code to produce the default graph. Here's the code and the output:
proc gchart data=my_data; hbar category / type=sum sumvar=percent; run;
That's a decent graph, and allows me to easily see and compare the 10 items ... but it could be a lot better with a little more work. Using several built-in options, and specifying characteristics in axis statements, I was able to get a graph that was much better looking, and also easier to compare the 10 items:
pattern1 v=s c=cx00B2EE; /* blue color */ axis1 label=none value=(j=right) offset=(4,4); axis2 label=none major=none minor=none style=0; proc gchart data=my_data; hbar category / type=sum sumvar=percent descending nostats maxis=axis1 raxis=axis2 noframe space=0 width=3.7 coutline=white autoref clipref cref=graydd; run;
That's a fine graph, but there is always room for improvement! I found myself looking from left-to-right quite a bit, to see the bar text and then the bar height. So I thought, why not print the text inside the bar, so I don't have to look all the way on the left side of the graph? There's no built-in option to do that, but I suppressed the default text labels by using value=none on the axis statement, and then used data-driven annotate to write the text on the bars. Depending on your preference, either of these two graphs might suit your needs.
data my_anno; set my_data; length text $100; xsys='2'; ysys='2'; hsys='3'; when='a'; midpoint=category; x=percent; function='label'; position='<'; style='albany amt/bold'; text=trim(left(category))||'a0a0'x; run; axis1 label=none value=none offset=(4,4); axis2 label=none major=none minor=none style=0; proc gchart data=my_data anno=my_anno; hbar category / type=sum sumvar=percent descending nostats maxis=axis1 raxis=axis2 noframe space=0 width=3.7 coutline=white autoref clipref cref=graydd; run;
Do you agree with Expedia's "Top 10" list? What's the most annoying behavior you've personally seen on a plane?