GPL question. How can I label axes on scatterplot with value labels

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

GPL question. How can I label axes on scatterplot with value labels

Art Kendall
If I have two Likert scale scores rescaled to the original response
scale, how can I have integer values on the axes labeled with the values
of the original response scale.  In the syntax below scores are from
scales with 10 items.

*scores on likert scales composed of 10 items .
*scaled to response scale.
new file.
input program.
    loop id = 1 to 50.
       compute x = rnd(RV.UNIFORM(9.5,50.5))/10.
       compute y = rnd(RV.UNIFORM(9.5,50.5))/10.
       end case.
    end loop.
    end file.
end input program.
value labels x y
    1 'SD'
    2 'D'
    3 'n'
    4 'A'
    5 'SA'.
var labels
    x 'some independent variable'/
    y 'some dependent variable'.
execute.
* Chart Builder.
GGRAPH
   /GRAPHDATASET NAME="graphdataset" VARIABLES=x y MISSING=LISTWISE
REPORTMISSING=NO
   /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
   SOURCE: s=userSource(id("graphdataset"))
   DATA: x=col(source(s), name("x"))
   DATA: y=col(source(s), name("y"))
   GUIDE: axis(dim(1), label("some independent variable"))
   GUIDE: axis(dim(2), label("some dependent variable"))
   ELEMENT: point(position(x*y))
END GPL.

--
Art Kendall
Social Research Consultants

=====================
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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: GPL question. How can I label axes on scatterplot with value labels

Art Kendall
to clarify I would want
"1" on the axes to be replaced with "SD"
"2" with "D"
"3" with "n"
"4" with "A"
"5" with "SA"
centered on the tick marks.

Art Kendall
Social Research Consultants


On 5/22/2012 7:52 AM, Art Kendall wrote:

> If I have two Likert scale scores rescaled to the original response
> scale, how can I have integer values on the axes labeled with the values
> of the original response scale.  In the syntax below scores are from
> scales with 10 items.
>
> *scores on likert scales composed of 10 items .
> *scaled to response scale.
> new file.
> input program.
>    loop id = 1 to 50.
>       compute x = rnd(RV.UNIFORM(9.5,50.5))/10.
>       compute y = rnd(RV.UNIFORM(9.5,50.5))/10.
>       end case.
>    end loop.
>    end file.
> end input program.
> value labels x y
>    1 'SD'
>    2 'D'
>    3 'n'
>    4 'A'
>    5 'SA'.
> var labels
>    x 'some independent variable'/
>    y 'some dependent variable'.
> execute.
> * Chart Builder.
> GGRAPH
>   /GRAPHDATASET NAME="graphdataset" VARIABLES=x y MISSING=LISTWISE
> REPORTMISSING=NO
>   /GRAPHSPEC SOURCE=INLINE.
> BEGIN GPL
>   SOURCE: s=userSource(id("graphdataset"))
>   DATA: x=col(source(s), name("x"))
>   DATA: y=col(source(s), name("y"))
>   GUIDE: axis(dim(1), label("some independent variable"))
>   GUIDE: axis(dim(2), label("some dependent variable"))
>   ELEMENT: point(position(x*y))
> END GPL.
>
> --
> Art Kendall
> Social Research Consultants
>
> =====================
> 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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: GPL question. How can I label axes on scatterplot with value labels

David Marso
Administrator
In reply to this post by Art Kendall
Since a scatterplot is fundamentally a graph designed for *continuous* data it seems unnatural to have discrete categorical labels indicated on the axes.  I know what you are after here but to achieve this you may need to play around in an image editing program.  OTOH, maybe Jon, Vi Ann or some other GPL expert might have an idea or two.

Art Kendall wrote
If I have two Likert scale scores rescaled to the original response
scale, how can I have integer values on the axes labeled with the values
of the original response scale.  In the syntax below scores are from
scales with 10 items.

*scores on likert scales composed of 10 items .
*scaled to response scale.
new file.
input program.
    loop id = 1 to 50.
       compute x = rnd(RV.UNIFORM(9.5,50.5))/10.
       compute y = rnd(RV.UNIFORM(9.5,50.5))/10.
       end case.
    end loop.
    end file.
end input program.
value labels x y
    1 'SD'
    2 'D'
    3 'n'
    4 'A'
    5 'SA'.
var labels
    x 'some independent variable'/
    y 'some dependent variable'.
execute.
* Chart Builder.
GGRAPH
   /GRAPHDATASET NAME="graphdataset" VARIABLES=x y MISSING=LISTWISE
REPORTMISSING=NO
   /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
   SOURCE: s=userSource(id("graphdataset"))
   DATA: x=col(source(s), name("x"))
   DATA: y=col(source(s), name("y"))
   GUIDE: axis(dim(1), label("some independent variable"))
   GUIDE: axis(dim(2), label("some dependent variable"))
   ELEMENT: point(position(x*y))
END GPL.

--
Art Kendall
Social Research Consultants

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: GPL question. How can I label axes on scatterplot with value labels

ViAnn Beadle
In reply to this post by Art Kendall
If you just want a simple scatterplot (no fit lines), define the variables
on the axes as categorical . If you're using chart builder, override the
level of measurement within it by right clicking on the variable in the
source list.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Art
Kendall
Sent: Tuesday, May 22, 2012 6:00 AM
To: [hidden email]
Subject: Re: GPL question. How can I label axes on scatterplot with value
labels

to clarify I would want
"1" on the axes to be replaced with "SD"
"2" with "D"
"3" with "n"
"4" with "A"
"5" with "SA"
centered on the tick marks.

Art Kendall
Social Research Consultants


On 5/22/2012 7:52 AM, Art Kendall wrote:

> If I have two Likert scale scores rescaled to the original response
> scale, how can I have integer values on the axes labeled with the
> values of the original response scale.  In the syntax below scores are
> from scales with 10 items.
>
> *scores on likert scales composed of 10 items .
> *scaled to response scale.
> new file.
> input program.
>    loop id = 1 to 50.
>       compute x = rnd(RV.UNIFORM(9.5,50.5))/10.
>       compute y = rnd(RV.UNIFORM(9.5,50.5))/10.
>       end case.
>    end loop.
>    end file.
> end input program.
> value labels x y
>    1 'SD'
>    2 'D'
>    3 'n'
>    4 'A'
>    5 'SA'.
> var labels
>    x 'some independent variable'/
>    y 'some dependent variable'.
> execute.
> * Chart Builder.
> GGRAPH
>   /GRAPHDATASET NAME="graphdataset" VARIABLES=x y MISSING=LISTWISE
> REPORTMISSING=NO
>   /GRAPHSPEC SOURCE=INLINE.
> BEGIN GPL
>   SOURCE: s=userSource(id("graphdataset"))
>   DATA: x=col(source(s), name("x"))
>   DATA: y=col(source(s), name("y"))
>   GUIDE: axis(dim(1), label("some independent variable"))
>   GUIDE: axis(dim(2), label("some dependent variable"))
>   ELEMENT: point(position(x*y))
> END GPL.
>
> --
> Art Kendall
> Social Research Consultants
>
> =====================
> 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
Reply | Threaded
Open this post in threaded view
|

Re: GPL question. How can I label axes on scatterplot with value labels

Andy W
In reply to this post by Art Kendall

To get labels like that you will need to define your two axes as categorical, and the values of x and y are not categorical in your example. Perhaps you want a jittered dot plot? Taking your data used above, I just turn x and y back into categorical variables. Also note on the DATA statements in the inline GPL you need to define the variable as categorical using the unit.category() command.

compute trunc_x = TRUNC(x).
compute trunc_y = TRUNC(y).

value labels trunc_x trunc_y
1 'SD'
2 'D'
3 'n'
4 'A'
5 'SA'.

GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=trunc_x trunc_y MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: trunc_x=col(source(s), name("trunc_x"), unit.category())
DATA: trunc_y=col(source(s), name("trunc_y"), unit.category())
GUIDE: axis(dim(1), label("some independent variable"))
GUIDE: axis(dim(2), label("some dependent variable"))
ELEMENT: point.jitter(position(trunc_x*trunc_y))
END GPL.

If you have many points, you can add transparency to them for better visualization (see here for an example). You could also just use some other encoding (such as size or color) to signify the number of points in each category grouping. A synonymous example would be the corrgram examples I provide in a blog post.

The jitterred points are perhaps more useful for ordinal data when you have many categories, which causes heavy striation in a scatter plot. In this example a simple table or summary encodings like in the corrgram example are probably easier to digest. I also give another example of dodging points (Y axis is continous but X axis is categorical) in this blog post, Avoid Dynamite Plots!.

I can think of ways to get around making the x and y categorical if that isn't what you want, but I'm hoping this will suffice.

Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: GPL question. How can I label axes on scatterplot with value labels

Jon K Peck
In reply to this post by Art Kendall
As others have said, you can't do that with a scale axis, but you could add annotations at the bottom of the chart with this text.  You would have to create them manually (unless a footnote would do), but they can be saved in a chart template and reused.

HTH,

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        Art Kendall <[hidden email]>
To:        [hidden email]
Date:        05/22/2012 06:03 AM
Subject:        Re: [SPSSX-L] GPL question. How can I label axes on scatterplot              with value              labels
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




to clarify I would want
"1" on the axes to be replaced with "SD"
"2" with "D"
"3" with "n"
"4" with "A"
"5" with "SA"
centered on the tick marks.

Art Kendall
Social Research Consultants


On 5/22/2012 7:52 AM, Art Kendall wrote:
> If I have two Likert scale scores rescaled to the original response
> scale, how can I have integer values on the axes labeled with the values
> of the original response scale.  In the syntax below scores are from
> scales with 10 items.
>
> *scores on likert scales composed of 10 items .
> *scaled to response scale.
> new file.
> input program.
>    loop id = 1 to 50.
>       compute x = rnd(RV.UNIFORM(9.5,50.5))/10.
>       compute y = rnd(RV.UNIFORM(9.5,50.5))/10.
>       end case.
>    end loop.
>    end file.
> end input program.
> value labels x y
>    1 'SD'
>    2 'D'
>    3 'n'
>    4 'A'
>    5 'SA'.
> var labels
>    x 'some independent variable'/
>    y 'some dependent variable'.
> execute.
> * Chart Builder.
> GGRAPH
>   /GRAPHDATASET NAME="graphdataset" VARIABLES=x y MISSING=LISTWISE
> REPORTMISSING=NO
>   /GRAPHSPEC SOURCE=INLINE.
> BEGIN GPL
>   SOURCE: s=userSource(id("graphdataset"))
>   DATA: x=col(source(s), name("x"))
>   DATA: y=col(source(s), name("y"))
>   GUIDE: axis(dim(1), label("some independent variable"))
>   GUIDE: axis(dim(2), label("some dependent variable"))
>   ELEMENT: point(position(x*y))
> END GPL.
>
> --
> Art Kendall
> Social Research Consultants
>
> =====================
> 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: GPL question. How can I label axes on scatterplot with value labels

Art Kendall
In reply to this post by David Marso
Thank you all for your help.

Yes a scatterplot is for variables that have a continuous variable as
the underlying construct.
And yes is is not conventional to rescale Likert scales to the original
response format.

However, rescaling to the original response scale does nothing to to
correlations, I have been thinking about making it clearer that low
scores indicate a tendency to respond to disagree and higher scores a
tendency to agree.

My current solution is to leave the variables as continuous and apply a
template.
The template would make the lower margin for Y to be 7% and for X to be
5% and add footnotes.
Moving the margins avoids have markers right on the axes.

Art Kendall
Social Research Consultants


On 5/22/2012 8:32 AM, David Marso wrote:

> Since a scatterplot is fundamentally a graph designed for *continuous* data
> it seems unnatural to have discrete categorical labels indicated on the
> axes.  I know what you are after here but to achieve this you may need to
> play around in an image editing program.  OTOH, maybe Jon, Vi Ann or some
> other GPL expert might have an idea or two.
>
>
> Art Kendall wrote
>> If I have two Likert scale scores rescaled to the original response
>> scale, how can I have integer values on the axes labeled with the values
>> of the original response scale.  In the syntax below scores are from
>> scales with 10 items.
>>
>> *scores on likert scales composed of 10 items .
>> *scaled to response scale.
>> new file.
>> input program.
>>      loop id = 1 to 50.
>>         compute x = rnd(RV.UNIFORM(9.5,50.5))/10.
>>         compute y = rnd(RV.UNIFORM(9.5,50.5))/10.
>>         end case.
>>      end loop.
>>      end file.
>> end input program.
>> value labels x y
>>      1 'SD'
>>      2 'D'
>>      3 'n'
>>      4 'A'
>>      5 'SA'.
>> var labels
>>      x 'some independent variable'/
>>      y 'some dependent variable'.
>> execute.
>> * Chart Builder.
>> GGRAPH
>>     /GRAPHDATASET NAME="graphdataset" VARIABLES=x y MISSING=LISTWISE
>> REPORTMISSING=NO
>>     /GRAPHSPEC SOURCE=INLINE.
>> BEGIN GPL
>>     SOURCE: s=userSource(id("graphdataset"))
>>     DATA: x=col(source(s), name("x"))
>>     DATA: y=col(source(s), name("y"))
>>     GUIDE: axis(dim(1), label("some independent variable"))
>>     GUIDE: axis(dim(2), label("some dependent variable"))
>>     ELEMENT: point(position(x*y))
>> END GPL.
>>
>> --
>> Art Kendall
>> Social Research Consultants
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@.UGA (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
>>
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/GPL-question-How-can-I-label-axes-on-scatterplot-with-value-labels-tp5713312p5713314.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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
Art Kendall
Social Research Consultants