Syntax for setting unique or alternating bar colors?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Syntax for setting unique or alternating bar colors?

Laflamme, David
Greetings.  I have searched the online archives and was not able to find
a previous related answer.  If you know of one, please feel free to just
point me to it.  Thanks in advance!

I am using SPSS v15.0.1.1

Some background -- the graphs shows masked facility identification
numbers on the x-axis (e.g. Facility 1, Facility 2, etc.).  The y-axis
shows the count of interest.  Leaders from each facility will be in the
audience during a multimedia presentation and will know their own
confidential facility number.  I think it will make it easier for them
to quickly pick out their bar on the graph if they also have a unique
color.  The order of the bars might not always be the same as the order
of the facility identification numbers (i.e. might order by value for
some vars of interest).  I used the point and click interactive graph
wizard to generate the IGRAPH syntax below as a starting point - though
if there is a better way to do it, I'm not stuck on using IGRAPH.

I want to show each bar in my graph as a different color -- n=23
facilities.  I realize this might require too many colors for this to be
reasonable.  Repeating a smaller number of colors so that two of the
same color are not near each other would be OK.  Even alternating just
two colors would probably make it more readable.  I need to make quite a
few versions of these, so doing it manually is not an attractive option.

Can anyone tell me how to achieve some version of this?  If you can
think of an alternate method of improving the readability, I am open to
hearing suggestions for that as well.  Many thanks!

-David

IGRAPH
 /VIEWNAME='Bar Chart'
 /X1 = VAR(location3) TYPE = CATEGORICAL
 /Y = $count
 /COORDINATE = HORIZONTAL
 /TITLE='XYZ characteristic by masked facility'
 /SUBTITLE='XXXXX'
 /X1LENGTH=3.0
 /YLENGTH=5.0
 /X2LENGTH=3.0
 /CHARTLOOK='C:\Program Files\SPSS\Looks\classic.clo'
 /CATORDER VAR(location3) (DESCENDING VALUES OMITEMPTY)
 /BAR KEY=OFF SHAPE = RECTANGLE BASELINE = 0.00.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Syntax for setting unique or alternating bar colors?

Keith McCormick
Hi David,
Since you are using version 15, I would urge you to use chart builder and
paste the Graphics Production Language (GPL). The GPL function that you will
want to look up is map aesthetic. You will be able to choose from dozens of
colors (look for "color constants").

GPL can be a little intimidating at first, but the map function is an easy
one to imitate from the GPL help. You can find the "GPL reference" in your
help, but don't try to read the whole thing, just paste, look up map, and
the color constants. Let the menus do the heavy lifting.

HTH,

Keith
www.keithmccormick.com

On Tue, Jan 13, 2009 at 1:21 PM, Laflamme, David <[hidden email]>wrote:

> Greetings.  I have searched the online archives and was not able to find
> a previous related answer.  If you know of one, please feel free to just
> point me to it.  Thanks in advance!
>
> I am using SPSS v15.0.1.1
>
> Some background -- the graphs shows masked facility identification
> numbers on the x-axis (e.g. Facility 1, Facility 2, etc.).  The y-axis
> shows the count of interest.  Leaders from each facility will be in the
> audience during a multimedia presentation and will know their own
> confidential facility number.  I think it will make it easier for them
> to quickly pick out their bar on the graph if they also have a unique
> color.  The order of the bars might not always be the same as the order
> of the facility identification numbers (i.e. might order by value for
> some vars of interest).  I used the point and click interactive graph
> wizard to generate the IGRAPH syntax below as a starting point - though
> if there is a better way to do it, I'm not stuck on using IGRAPH.
>
> I want to show each bar in my graph as a different color -- n=23
> facilities.  I realize this might require too many colors for this to be
> reasonable.  Repeating a smaller number of colors so that two of the
> same color are not near each other would be OK.  Even alternating just
> two colors would probably make it more readable.  I need to make quite a
> few versions of these, so doing it manually is not an attractive option.
>
> Can anyone tell me how to achieve some version of this?  If you can
> think of an alternate method of improving the readability, I am open to
> hearing suggestions for that as well.  Many thanks!
>
> -David
>
> IGRAPH
>  /VIEWNAME='Bar Chart'
>  /X1 = VAR(location3) TYPE = CATEGORICAL
>  /Y = $count
>  /COORDINATE = HORIZONTAL
>  /TITLE='XYZ characteristic by masked facility'
>  /SUBTITLE='XXXXX'
>  /X1LENGTH=3.0
>  /YLENGTH=5.0
>  /X2LENGTH=3.0
>  /CHARTLOOK='C:\Program Files\SPSS\Looks\classic.clo'
>  /CATORDER VAR(location3) (DESCENDING VALUES OMITEMPTY)
>  /BAR KEY=OFF SHAPE = RECTANGLE BASELINE = 0.00.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD