How to modify legend in IGRAPH?

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

How to modify legend in IGRAPH?

Zuluaga, Juan
Hello SPSS people,
I have the following stacked bar graph,
http://web.stcloudstate.edu/jzuluaga/spss/stacked1.png
made with

IGRAPH
  /VIEWNAME='Bar Chart'
  /X1=VAR(Group) TYPE=CATEGORICAL
  /Y=$count title="Proportion"
  /COLOR=VAR(Ethnicity) TYPE=CATEGORICAL STACK
  /COORDINATE=VERTICAL
  /NORMALIZE
  /YLENGTH=5.2
  /X1LENGTH=6.5
  /CHARTLOOK='NONE'
  /CATORDER VAR(Group) (ASCENDING VALUES OMITEMPTY)
  /CATORDER VAR(Ethnicity) (ASCENDING VALUES OMITEMPTY)
  /BAR KEY=ON SHAPE=RECTANGLE BASELINE=AUTO
  /TITLE='Ethnic composition of groups'.


(I copied and tweaked this code from somewhere, and I've been unable to redo the graph via the point-and-click interface).

1) Using syntax, how can I modify or delete the little title on the right that says "Bars show count"? -- they are not counts, but proportions.

2) Using syntax, how can I supply it with a list of colors of my choice for level1, level2, etc of variable Ethnicity?

Thank you!
-j

=====================
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: How to modify legend in IGRAPH?

ViAnn Beadle
One tactic is to try to fix it up via a chart template. First, you can
control the default colors via Edit>Options>Charts and click on the Colors
button. This will save an internally modified template which will be applied
to all charts generated from IGRAPH and GGRAPH.

Second, see if you can delete that secondary legend in the chart editor and
then save a special chart template to apply to the chart over the top of the
internal chart template. Depending upon version this may or may not work.
Another approach to get rid of that legend is to change the text color to
match whatever background color you are using so that it won't be visible.
Then save the template with that choice. A third approach is to see if you
can move that legend behind the chart and then save the layout in the
template.

When saving a template check only the few things that you want to be
applied. You can then use the SET command to specify the saved chart
template.

Another tactic might  be to use the Chart Builder to recreate your chart and
then save the syntax from that. I'm not sure what the proportion is actually
doing in the IGRAPH syntax. Is this really a percentage?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Zuluaga, Juan
Sent: Monday, May 16, 2011 2:15 PM
To: [hidden email]
Subject: How to modify legend in IGRAPH?

Hello SPSS people,
I have the following stacked bar graph,
http://web.stcloudstate.edu/jzuluaga/spss/stacked1.png
made with

IGRAPH
  /VIEWNAME='Bar Chart'
  /X1=VAR(Group) TYPE=CATEGORICAL
  /Y=$count title="Proportion"
  /COLOR=VAR(Ethnicity) TYPE=CATEGORICAL STACK
  /COORDINATE=VERTICAL
  /NORMALIZE
  /YLENGTH=5.2
  /X1LENGTH=6.5
  /CHARTLOOK='NONE'
  /CATORDER VAR(Group) (ASCENDING VALUES OMITEMPTY)
  /CATORDER VAR(Ethnicity) (ASCENDING VALUES OMITEMPTY)
  /BAR KEY=ON SHAPE=RECTANGLE BASELINE=AUTO
  /TITLE='Ethnic composition of groups'.


(I copied and tweaked this code from somewhere, and I've been unable to redo
the graph via the point-and-click interface).

1) Using syntax, how can I modify or delete the little title on the right
that says "Bars show count"? -- they are not counts, but proportions.

2) Using syntax, how can I supply it with a list of colors of my choice for
level1, level2, etc of variable Ethnicity?

Thank you!
-j

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: How to modify legend in IGRAPH? (solution)

Zuluaga, Juan
Thank you ViAnn,

I confess that I copied the IGRAPH code from your own May 15 post here.

It actually only needs a little change, in the line /Y, it should be
/Y=$pct instead of $count
and this fixes both the left hand legend and the little box legend on the right side.



> Another tactic might  be to use the Chart Builder to recreate your chart and
>then save the syntax from that. I'm not sure what the proportion is actually
>doing in the IGRAPH syntax. Is this really a percentage?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Zuluaga, Juan
Sent: Monday, May 16, 2011 2:15 PM
To: [hidden email]
Subject: How to modify legend in IGRAPH?

Hello SPSS people,
I have the following stacked bar graph,
http://web.stcloudstate.edu/jzuluaga/spss/stacked1.png
made with

IGRAPH
  /VIEWNAME='Bar Chart'
  /X1=VAR(Group) TYPE=CATEGORICAL
  /Y=$count title="Proportion"
  /COLOR=VAR(Ethnicity) TYPE=CATEGORICAL STACK
  /COORDINATE=VERTICAL
  /NORMALIZE
  /YLENGTH=5.2
  /X1LENGTH=6.5
  /CHARTLOOK='NONE'
  /CATORDER VAR(Group) (ASCENDING VALUES OMITEMPTY)
  /CATORDER VAR(Ethnicity) (ASCENDING VALUES OMITEMPTY)
  /BAR KEY=ON SHAPE=RECTANGLE BASELINE=AUTO
  /TITLE='Ethnic composition of groups'.


(I copied and tweaked this code from somewhere, and I've been unable to redo
the graph via the point-and-click interface).

1) Using syntax, how can I modify or delete the little title on the right
that says "Bars show count"? -- they are not counts, but proportions.

2) Using syntax, how can I supply it with a list of colors of my choice for
level1, level2, etc of variable Ethnicity?

Thank you!
-j

=====================
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