Boxplot chart editing problem

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

Boxplot chart editing problem

Walter Funk
Dear fellow SPSS-users,

I ran an examine-run to receive a boxplot. Editing the chart, I want the
median values to be shown in little boxes right besides the median line
in the single arbours. I know we did this a year or two ago with SPSS 13
(or was it still version 11.5?), but I can’t find the proper menu in the
properties window in SPSS 15. Is this feature not available any more?

Thanks for your help

Greetings from Germany
Walter

=====================
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: Boxplot chart editing problem

Walter Funk
Hi again,

as I just got to know, that my intention to edit a boxplot chart the way
I intended it to do, is not possible and was not possible in V13. My
collegue must have inserted the respective textboxes in V13 separately
and filled it with the mean value by hand.

Thank you for your attention.
Walter


Walter Funk schrieb:

> Dear fellow SPSS-users,
>
> I ran an examine-run to receive a boxplot. Editing the chart, I want the
> median values to be shown in little boxes right besides the median line
> in the single arbours. I know we did this a year or two ago with SPSS 13
> (or was it still version 11.5?), but I can’t find the proper menu in the
> properties window in SPSS 15. Is this feature not available any more?
>
> Thanks for your help
>
> Greetings from Germany
> Walter
>
> =====================
> 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
|

AW: Boxplot chart editing problem

la volta statistics
Hi Walter
I had actually a similar problem recently. I came up with doing the box
blots with GPL and using annotations for placing the median value just next
to the median line.
The procedure, I made, had three parts:
1.      reading the median per subgroup (I used python, you could also use the
Aggregate command with a temporary selection, if you do not have python
installed. See alternative for Median Values at the end of the code).
2.      Generating dynamically a template for annotation boxes with the values
and their position (Med_1, Med_2, Med_3).
3.      run the GPL command with the template created in step 2.

I know, this looks like a rather complicate procedure. However, if you have
a lot of charts to do, it will save you much work that otherwise you have to
do by hand.
Note that the padding-left="120px" part in the template sets the annotation
to the 120px left, that otherwise would be at the centre of the category.

Hope this helps.
Christian
*******************************
la volta statistics
Christian Schmidhauser, Dr.phil.II
Weinbergstrasse 108
Ch-8006 Zürich
Tel: +41 (043) 233 98 01
Fax: +41 (043) 233 98 02
email: mailto:[hidden email]
internet: http://www.lavolta.ch/


*-------------------------------------------------------*.
*  use the employee data.sav form SPSS for this example.
*-------------------------------------------------------*.



****************************************************.
* Part 1.
* Generate macro values for median.
*(replace this part if you do not have python with
* alternative code at the end if the syntax.
****************************************************.
AGGREGATE
  /OUTFILE=*
  MODE=ADDVARIABLES
  /BREAK=jobcat
  /salary_median = MEDIAN(salary).

TEMP.
SELECT IF JOBCAT = 1.
BEGIN PROGRAM.
import spss,spssaux
cmd="DESCRIPTIVES VARIABLES=salary_median/STATISTICS=MAX."
desc_table,errcode=spssaux.CreateXMLOutput(
                   cmd,
                   omsid="Descriptives")
medsal1=spssaux.GetValuesFromXMLWorkspace(
                   desc_table,
                   tableSubtype="Descriptive Statistics",
                   rowCategory="salary_median",
                   colCategory="Maximum",
                   cellAttrib="text")
spss.SetMacroValue("!medsal1", medsal1[0])
END PROGRAM.
*Title !medsal1.

TEMP.
SELECT IF JOBCAT = 2.
BEGIN PROGRAM.
import spss,spssaux
cmd="DESCRIPTIVES VARIABLES=salary_median/STATISTICS=MAX."
desc_table,errcode=spssaux.CreateXMLOutput(
                   cmd,
                   omsid="Descriptives")
medsal2=spssaux.GetValuesFromXMLWorkspace(
                   desc_table,
                   tableSubtype="Descriptive Statistics",
                   rowCategory="salary_median",
                   colCategory="Maximum",
                   cellAttrib="text")
spss.SetMacroValue("!medsal2", medsal2[0])
END PROGRAM.
*Title !medsal2.

TEMP.
SELECT IF JOBCAT = 3.
BEGIN PROGRAM.
import spss,spssaux
cmd="DESCRIPTIVES VARIABLES=salary_median/STATISTICS=MAX."
desc_table,errcode=spssaux.CreateXMLOutput(
                   cmd,
                   omsid="Descriptives")
medsal3=spssaux.GetValuesFromXMLWorkspace(
                   desc_table,
                   tableSubtype="Descriptive Statistics",
                   rowCategory="salary_median",
                   colCategory="Maximum",
                   cellAttrib="text")
spss.SetMacroValue("!medsal3", medsal3[0])
END PROGRAM.
*Title !medsal3.

Compute Med_1 = !medsal1.
Compute Med_2 = !medsal2.
Compute Med_3 = !medsal3.
FORMAT Med_1  Med_2 Med_3 (F8.0).
Exec.


***********************************.
* Part 2.
* Generate template.
***********************************.

Do if $casenum = 1.
WRITE OUTFILE='c:\temp\AddAnotation.sgt'
/'<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
/'<template SPSS-Version="2.2" '
/' selectPath="900 " '
/' xmlns="http://xml.spss.com/spss/visualization" '
/' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
/' xsi:schemaLocation="http://xml.spss.com/spss/visualization '
/' http://xml.spss.com/spss/visualization/vizml-template-3.0.xsd">'
/'      <addAnchoredAnnotation styleOnly="false" '
/'              x="Clerical" '
/'              xcategorical="true" '
/'              y="'
/Med_1
/'"'
/'              ycategorical="false"> '
/'                      <label>Med = 'Med_1'<style color="transparent" '
/'                               color2="transparent" '
/'                               number = "1" '
/'                               padding-left="120px"  '
/'                               visible="true"/></label> '
/'      </addAnchoredAnnotation> '
/'      <addAnchoredAnnotation styleOnly="false" '
/'              x="Custodial" '
/'              xcategorical="true" '
/'              y="'
/Med_2
/'"'
/'              ycategorical="false"> '
/'                   <label>Med. = 'Med_2'<style color="transparent" '
/'                               color2="transparent" '
/'                               number = "1" '
/'                               padding-left="120px"  '
/'                               visible="true"/></label> '
/'      </addAnchoredAnnotation> '
/'      <addAnchoredAnnotation styleOnly="false" '
/'              x="Manager" '
/'              xcategorical="true" '
/'              y="'
/Med_3
/'"'
/'              ycategorical="false"> '
/'                   <label>Med. = 'Med_3'<style color="transparent" '
/'                               color2="transparent" '
/'                               number = "1" '
/'                               padding-left="120px"  '
/'                               visible="true"/></label> '
/'      </addAnchoredAnnotation> '
/'</template>'.
End if.
EXECUTE.



***********************************.
* Part 3.
* Generate Chart.
***********************************.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES= salary jobcat MISSING=LISTWISE
REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE
TEMPLATE=[
"c:\temp\AddAnotation.sgt"].
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: jobcat=col(source(s), name("jobcat"), unit.category())
DATA: salary=col(source(s), name("salary"))
SCALE: cat(aesthetic(aesthetic.color.interior), map(("1",color.red),
("2",color.blue), ("3",color.green) ))
GUIDE: legend(aesthetic(aesthetic.color), null())
GUIDE: axis(dim(2), label("Salary"))
GUIDE: axis(dim(1), label("Job Category"))
ELEMENT: schema(position(bin.quantile.letter(jobcat*salary)), color(jobcat))
END GPL.

*-------------------------------------------3.

*************************************.
* Alternative code for Median values.
*************************************.

TEMP.
SELECT IF JOBCAT = 1.
AGGREGATE
  /OUTFILE=*
  MODE=ADDVARIABLES
  /BREAK=jobcat
  /Med_1 = MEDIAN(salary).
Sort Cases by med_1 (D).
If (Missing(med_1)) med_1 = LAG(med_1).

TEMP.
SELECT IF JOBCAT = 2.
AGGREGATE
  /OUTFILE=*
  MODE=ADDVARIABLES
  /BREAK=jobcat
  /Med_2 = MEDIAN(salary).
Sort Cases by med_2 (D).
If (Missing(med_2)) med_2 = LAG(med_2).

TEMP.
SELECT IF JOBCAT = 3.
AGGREGATE
  /OUTFILE=*
  MODE=ADDVARIABLES
  /BREAK=jobcat
  /Med_3 = MEDIAN(salary).
Sort Cases by med_3 (D).
If (Missing(med_3)) med_3 = LAG(med_3).

FORMAT Med_1  Med_2 Med_3 (F8.0).
Exec.

********************************************.
* End of Alternative code for Median values.
********************************************.


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]]Im Auftrag von
Walter Funk
Gesendet: Mittwoch, 12. Dezember 2007 15:58
An: [hidden email]
Betreff: Re: Boxplot chart editing problem


Hi again,

as I just got to know, that my intention to edit a boxplot chart the way
I intended it to do, is not possible and was not possible in V13. My
collegue must have inserted the respective textboxes in V13 separately
and filled it with the mean value by hand.

Thank you for your attention.
Walter


Walter Funk schrieb:

> Dear fellow SPSS-users,
>
> I ran an examine-run to receive a boxplot. Editing the chart, I want the
> median values to be shown in little boxes right besides the median line
> in the single arbours. I know we did this a year or two ago with SPSS 13
> (or was it still version 11.5?), but I can’t find the proper menu in the
> properties window in SPSS 15. Is this feature not available any more?
>
> Thanks for your help
>
> Greetings from Germany
> Walter
>
> =====================
> 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

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