Break Y axis in a Graph

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

Break Y axis in a Graph

Pol
Hello,

I have made some graphs in SPSS where the Y-axis ranks from 1 to 7. I was asked by the editor to "break" the Y axis (i.e. add a / in between e.g. 1-3 so that I widen the plot area).

Is that possible at all in SPSS? I found a command "break" but it is only for categorical variables.

Thanks,

Pol
Reply | Threaded
Open this post in threaded view
|

Automatic reply: Break Y axis in a Graph

jdiez@magellanbr.com

I am out of the office and my phone is not currently receiving emails.  If this can't wait until the morning, please text me at 2254850405.

Reply | Threaded
Open this post in threaded view
|

Re: Break Y axis in a Graph

Art Kendall
In reply to this post by Pol
What is your syntax?

Do you mean that you want more ticks on the Y axis? 
Do you simply want a longer Y axis with the same ticks?
Did you open the output and try the chart editor?
Art Kendall
Social Research Consultants
On 5/24/2013 5:34 AM, centaur [via SPSSX Discussion] wrote:
Hello,

I have made some graphs in SPSS where the Y-axis ranks from 1 to 7. I was asked by the editor to "break" the Y axis (i.e. add a / in between e.g. 1-3 so that I widen the plot area).

Is that possible at all in SPSS? I found a command "break" but it is only for categorical variables.

Thanks,

Pol


If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/Break-Y-axis-in-a-Graph-tp5720388.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Break Y axis in a Graph

Andy W
In reply to this post by Pol
As stated it is awful advice by the editor! No you can't "break" SPSS charts, but there are some obvious ways, especially with categorical data, to achieve the same effect. Can you please elaborate on exactly what you want (graphic or hand-drawing of example chart, example data etc.)
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: Break Y axis in a Graph

Bruce Weaver
Administrator
In reply to this post by Art Kendall
I believe the OP is asking for something like you see here:

   http://www.physicsforums.com/showthread.php?t=392043


Art Kendall wrote
What is your syntax?
       
        Do you mean that you want more ticks on the Y axis? 
              Do you simply want a longer
                  Y axis with the same ticks?
              Did you open the output
                  and try the chart editor?
           
      Art Kendall
Social Research Consultants
      On 5/24/2013 5:34 AM, centaur [via SPSSX Discussion] wrote:
   
     Hello,
     
     
      I have made some graphs in SPSS where the Y-axis ranks from 1 to
      7. I was asked by the editor to "break" the Y axis (i.e. add a /
      in between e.g. 1-3 so that I widen the plot area).
     
      Is that possible at all in SPSS? I found a command "break" but it
      is only for categorical variables.
     
     
      Thanks,
     
     
      Pol
     
     
     
        If you reply to this email, your
          message will be added to the discussion below:
        http://spssx-discussion.1045642.n5.nabble.com/Break-Y-axis-in-a-Graph-tp5720388.html 
     
     
        To start a new topic under SPSSX Discussion, email
        [hidden email] 
        To unsubscribe from SPSSX Discussion, click
          here .
        NAML
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Pol
Reply | Threaded
Open this post in threaded view
|

Re: Break Y axis in a Graph

Pol
Thank you all for the replies,

I agree that the editor is not correct, but I cannot go against his recommendations.

I try to be a bit more elaborate on what I want to do. I attach the syntax below as well of the original graph. My task is to plot an interaction effect between a continuous and a categorical variable.

The problem is that the variable on the Y axis is measured in a 7 point scale (1 to 7). Given I am plotting means these range from 4,5 to 5,0 and it's hard to make the effects evident when using the full scale. Thus the editor asked me to break the Y axis in order to widen the scale, but at the same time making it evident that it ranges from 1 to 7.

It's hard to explain, but hope it's clear of what I need to do.


---///---
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=EM HEALTH_FPV FUN MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: EM=col(source(s), name("EM"))
  DATA: HEALTH_FPV=col(source(s), name("HEALTH_FPV"))
  DATA: FUN=col(source(s), name("FUN"), unit.category())
  GUIDE: axis(dim(1), label("Enduring Motivation"))
  GUIDE: axis(dim(2), label("Perceived Healthfulness)"))
  GUIDE: legend(aesthetic(aesthetic.color.interior), label("Functional Claim"))
  SCALE: cat(aesthetic(aesthetic.color.interior), include("0", "1"))
  ELEMENT: line(position(smooth.spline(EM*HEALTH_FPV)), color.interior(FUN), missing.wings())
END GPL.
Reply | Threaded
Open this post in threaded view
|

Re: Break Y axis in a Graph

Art Kendall
Might your editor be happy with

GUIDE: axis(dim(2), label("Mean Perceived Healthfulness on 1 to 7 scale)"))

?
Art Kendall
Social Research Consultants
On 5/24/2013 8:22 AM, centaur [via SPSSX Discussion] wrote:
Thank you all for the replies,

I agree that the editor is not correct, but I cannot go against his recommendations.

I try to be a bit more elaborate on what I want to do. I attach the syntax below as well of the original graph. My task is to plot an interaction effect between a continuous and a categorical variable.

The problem is that the variable on the Y axis is measured in a 7 point scale (1 to 7). Given I am plotting means these range from 4,5 to 5,0 and it's hard to make the effects evident when using the full scale. Thus the editor asked me to break the Y axis in order to widen the scale, but at the same time making it evident that it ranges from 1 to 7.

It's hard to explain, but hope it's clear of what I need to do.


---///---
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=EM HEALTH_FPV FUN MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: EM=col(source(s), name("EM"))
  DATA: HEALTH_FPV=col(source(s), name("HEALTH_FPV"))
  DATA: FUN=col(source(s), name("FUN"), unit.category())
  GUIDE: axis(dim(1), label("Enduring Motivation"))
  GUIDE: axis(dim(2), label("Perceived Healthfulness)"))
  GUIDE: legend(aesthetic(aesthetic.color.interior), label("Functional Claim"))
  SCALE: cat(aesthetic(aesthetic.color.interior), include("0", "1"))
  ELEMENT: line(position(smooth.spline(EM*HEALTH_FPV)), color.interior(FUN), missing.wings())
END GPL.



If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/Break-Y-axis-in-a-Graph-tp5720388p5720393.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Break Y axis in a Graph

Andy W
In reply to this post by Pol

I agree with Art, it is better just to annotate the chart. So, you can not do broken axis in SPSS charts, the simplest way would be the make the chart, export to whatever image format, and post-hoc edit in the break lines.

Again, I would encourage you to say no to the editor. Here is an alternative to make a paneled graphic with one panel zoomed in and the other zoomed out. Also you could just paste the two seperate graphs together pretty easily in an image editing program.


**************************************************************************************************************************************************.
data list free / EM HEALTH_FPV FUN.
begin data
1 4.5 1
1 4.8 0
2 5.0 1
2 4.6 0
3 4.5 1
3 4.8 0
end data.
dataset name orig.
value labels FUN
0 'Zero'
1 'One'.

*Original Chart.
GGRAPH 
  /GRAPHDATASET NAME="graphdataset" VARIABLES=EM HEALTH_FPV FUN MISSING=LISTWISE REPORTMISSING=NO 
  /GRAPHSPEC SOURCE=INLINE. 
BEGIN GPL 
  SOURCE: s=userSource(id("graphdataset")) 
  DATA: EM=col(source(s), name("EM")) 
  DATA: HEALTH_FPV=col(source(s), name("HEALTH_FPV")) 
  DATA: FUN=col(source(s), name("FUN"), unit.category()) 
  GUIDE: axis(dim(1), label("Enduring Motivation")) 
  GUIDE: axis(dim(2), label("Perceived Healthfulness)")) 
  GUIDE: legend(aesthetic(aesthetic.color.interior), label("Functional Claim")) 
  SCALE: cat(aesthetic(aesthetic.color.interior), include("0", "1")) 
  ELEMENT: line(position(smooth.spline(EM*HEALTH_FPV)), color.interior(FUN), missing.wings()) 
END GPL.

*Can restrict or widen the axis ranges using SCALE statement for dim(2).
GGRAPH 
  /GRAPHDATASET NAME="graphdataset" VARIABLES=EM HEALTH_FPV FUN MISSING=LISTWISE REPORTMISSING=NO 
  /GRAPHSPEC SOURCE=INLINE. 
BEGIN GPL 
  SOURCE: s=userSource(id("graphdataset")) 
  DATA: EM=col(source(s), name("EM")) 
  DATA: HEALTH_FPV=col(source(s), name("HEALTH_FPV")) 
  DATA: FUN=col(source(s), name("FUN"), unit.category()) 
  GUIDE: axis(dim(1), label("Enduring Motivation")) 
  GUIDE: axis(dim(2), label("Perceived Healthfulness)")) 
  GUIDE: legend(aesthetic(aesthetic.color.interior), label("Functional Claim")) 
  SCALE: cat(aesthetic(aesthetic.color.interior), include("0", "1")) 
  SCALE: linear(dim(2), min(4), max(5.1))
  ELEMENT: line(position(smooth.spline(EM*HEALTH_FPV)), color.interior(FUN), missing.wings()) 
END GPL.
*I would IMO, use this chart and just add proper annotation that the range really goes between 1 and 7.
*Graph of full range.
GGRAPH 
  /GRAPHDATASET NAME="graphdataset" VARIABLES=EM HEALTH_FPV FUN MISSING=LISTWISE REPORTMISSING=NO 
  /GRAPHSPEC SOURCE=INLINE. 
BEGIN GPL 
  SOURCE: s=userSource(id("graphdataset")) 
  DATA: EM=col(source(s), name("EM")) 
  DATA: HEALTH_FPV=col(source(s), name("HEALTH_FPV")) 
  DATA: FUN=col(source(s), name("FUN"), unit.category()) 
  GUIDE: axis(dim(1), label("Enduring Motivation")) 
  GUIDE: axis(dim(2), label("Perceived Healthfulness)")) 
  GUIDE: legend(aesthetic(aesthetic.color.interior), label("Functional Claim")) 
  SCALE: cat(aesthetic(aesthetic.color.interior), include("0", "1")) 
  SCALE: linear(dim(2), min(1), max(7))
  ELEMENT: line(position(smooth.spline(EM*HEALTH_FPV)), color.interior(FUN), missing.wings()) 
END GPL.

*Can plot two seperate plots, one with the wide range and the other with a restricted range.
*This is alittle more difficult, we can add in some fake data to trick SPSS to making the charts the specified ranges.

data list free / EM HEALTH_FPV HEALTH_FPV2 FUN.
begin data
1 3.9 1 3
2 5.0 7 3
end data.
dataset name add.

dataset activate orig.
compute HEALTH_FPV2 = HEALTH_FPV.
add files file = *
/file = 'add'.
dataset close add.
add value labels FUN
3 " ".


*Making the new data invisible.
GGRAPH 
  /GRAPHDATASET NAME="graphdataset" VARIABLES=EM HEALTH_FPV HEALTH_FPV2 FUN MISSING=LISTWISE REPORTMISSING=NO 
  /GRAPHSPEC SOURCE=INLINE. 
BEGIN GPL 
  SOURCE: s=userSource(id("graphdataset")) 
  DATA: EM=col(source(s), name("EM")) 
  DATA: HEALTH_FPV=col(source(s), name("HEALTH_FPV")) 
  DATA: HEALTH_FPV2=col(source(s), name("HEALTH_FPV2")) 
  DATA: FUN=col(source(s), name("FUN"), unit.category())
  TRANS: Hres = eval("Restricted Range FPV")
  TRANS: Hfull= eval("Full Range FPV")
  GUIDE: axis(dim(1), label("Enduring Motivation")) 
  GUIDE: axis(dim(2), label("Perceived Healthfulness)")) 
  GUIDE: legend(aesthetic(aesthetic.color.interior), label("Functional Claim")) 
  SCALE: cat(aesthetic(aesthetic.color.interior), include("0", "1"))
  SCALE: cat(aesthetic(aesthetic.transparency), map(("0", transparency."0"),("1",transparency."0"),("3",transparency."1")))
  ELEMENT: line(position(smooth.spline(EM*(HEALTH_FPV/Hres+HEALTH_FPV2/Hfull))), color.interior(FUN), missing.wings(), transparency(FUN)) 
END GPL.

*I thought you could use scale ranges like below with the original data, but that did not work.
*SCALE: linear(dim(2.1), min(4), max(5.1))
*SCALE: linear(dim(2.2), min(1), max(7))
*Also could not get visible function to work - so used transparency instead and made label a blank space.
*SCALE: cat(aesthetic(aesthetic.visible), map(("0", visible.true),("1",visible.true),("3",visible.false))).
**************************************************************************************************************************************************.

Another solution would be to use multiple graphs within a GPL block and set explicit min and max's for the SCALE.

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

Automatic reply: Break Y axis in a Graph

Mikki Haegle

I am off enjoying some vacation time.

 

I will return on June 17th and will respond to messages once I am back in the Lab.

 

~M

 

 

 

 

Mikki Haegle

Psychology Lab Coordinator

700 E 7th Street, NM-L202

St Paul, MN 55106

651.793.1354

 

Pol
Reply | Threaded
Open this post in threaded view
|

Re: Automatic reply: Break Y axis in a Graph

Pol
Thank you all for the help and replies!

The best solution proved to be the use of Photoshop. The editor seemed to be happy and the indication of the original scale seemed to work fine and not be misleading to the reader.

Thanks again!