Data visualization with SAS programming

gchart wanting more patterns

Reply
N/A
Posts: 0

gchart wanting more patterns

I've got a report (stacked bar chart) that is finished except they don't like the patterns. The charts look great except the patterns are hard to distinguish especially when printed in black and white.

I'm currently using the standard L1-L5, R1-R5, X1-X5 but it looks like other patterns may be available. However, I've not been able to correctly specify anything except the standard patterns.

Can anyone point me to how to set the value= part of the pattern giving more patterns?
SAS Employee
Posts: 963

Re: gchart wanting more patterns

I think the L (left), R (right), and X (cross-hatch) patterns are the only ones, besides solid ones (using colors, or shades of gray).

One other possibility - if you have various pattern samples in an image file,
you could use that image as the fill pattern (assuming it's a 2d bar chart,
not a 3d one ... and maybe a few more limitations & gotchas).


The pattern statement would be something like the following (the color only comes into play, if the image file can't be found)...

pattern1 color=blue v=s image='random_pattern.gif' imagestyle=tile;
Super Contributor
Posts: 291

Re: gchart wanting more patterns

Given the difficulty of reading / interpreting the stacked bar (an inherent stacked bar problem), you might want to consider small multiples of unstacked bars. You will likely improve the readability quite considerably. Here's a link to an example of small multiples: http://www.robslink.com/SAS/democd15/scen3b.htm
N/A
Posts: 0

Re: gchart wanting more patterns

the problem is unstacking the bars makes comparisons more difficult.

this is an analysis of a survey so each bar represents either a different question or group of respondents. Using a stacked bar allows me to compare percentages of different answers. For example, all negative answers are colored red from left to right with most negative on the far left and least negative on the right, then the positive answers are colored green with most positive on the far right and least positive on the left and a neutral answer in the center. This arrangement allows the viewer to quickly compare questions and groups and quickly focus in on problems
Super Contributor
Posts: 291

Re: gchart wanting more patterns

So the bars run from say -5 to +5 and each value has a frequency attached to it? Can you share the numbers for 2 or 3 bars?
N/A
Posts: 0

Re: gchart wanting more patterns

what I plot in the stacked bar is the cumulative percent in a horizontal bar chart so if the 20% gave each answer of a 5 part question the first section would run from 0 to 20, the second 20 to 40 and then 60 - 80 etc until 100 percent was reached.
Super Contributor
Posts: 291

Re: gchart wanting more patterns

Bill;

If I understand your situation somewhat, I think that your data and display is something similar to the first hbar line below. The second hbar produces a display that facilitates a more direct comparison of the response rate of the various answers. But maybe I misunderstand!

data QandA;
input q a pct;
datalines;
1 1 20
1 2 20
1 3 20
1 4 20
1 5 20
2 1 15
2 2 25
2 3 10
2 4 42
2 5 08
3 1 12
3 2 30
3 3 17
3 4 18
3 5 23
;
run;

proc gchart data=QandA;
hbar q/discrete
subgroup=a
sumvar=pct;
run;

hbar a/discrete
group=q
sumvar=pct;
run;
N/A
Posts: 0

Re: gchart wanting more patterns

your correct

the problem is that when a non-color copy is made of a chart, solid colors are often impossible to distinguish. As a result I different hash patterns. However, when some of the segments are very small the hash patterns become difficult also. Therefore, I'm wanting a greater selection of hash patterns.
SAS Employee
Posts: 963

Re: gchart wanting more patterns

Several years ago I put in a request/suggestion for some new/additional patterns, with varying densities of dots (request S0227341), but the idea got shot down.

If Tech Support hears more users needing/requesting such a feature (new dot-patterns, or other/more patterns), this will help increase the likelihood of such enhancements being added! Smiley Happy
N/A
Posts: 0

Re: gchart wanting more patterns

I debate creating a bunch of pattern like images and using them.

Or maybe someone out there has already done this? All you might do is find patterns available in other apps either print them or use copy and paste in a photo editor. I personally don't have the time
Super Contributor
Posts: 291

Re: gchart wanting more patterns

Bill K;

You are most correct - colour printing to b/w is a challenge. Few colours are b/w compliant and quite specific ones at that. I've found www.colorbrewer2.org to be very helpful for choosing colours that are print, screen, projector and colour blind compliant.
The snippet of code below should serve as a prototype to display your data in a meaningful way with individual and cumulative values - based on the data generated in an earlier response - without the need to resort to a lot of patterns or colours.

proc gchart data=QandA;

hbar a/discrete
group=q
freq=pct g100 cfreq;

Hope this helps,
Bill
Post a Question
Discussion Stats
  • 10 replies
  • 223 views
  • 0 likes
  • 3 in conversation