Two charts in one diagram?

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

Two charts in one diagram?

Robert L
I plan to submit a comment to a magazine where the Discussions corner accepts one chart only. I have got two variables though, and it would be very neat to set up one single chart with two separate dotplots for these separate variables. Stacking them row-wise or using two columns does not matter, the only thing needed is to let the dot plots use two separate x axes. I guess combining two charts could be done with a bit of photoshopping, but there could also be way to achieve it within SPSS. Any suggestions?

Robert
******************
Robert Lundqvist
Norrbotten regional council
Sweden

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

Re: Two charts in one diagram?

Jon K Peck
You can do this with GPL by using its GRAPH statement.  Here is an example using the employee data.sav file shipped with Statistics.  The tricky part is figuring out how to lay out the charts so that everything fits.  I have also specified the size of the combined charts - here 5 inches wide and 4 inches high.

GGRAPH /GRAPHDATASET NAME="graphdataset"
VARIABLES= jobcat educ
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset") )
PAGE: begin(scale(5.0in, 4.0in))
DATA: jobcat = col(source(s), name("jobcat"), unit.category() )
GRAPH: begin(origin(15.0%, 0%), scale(42.5%, 75%))
GUIDE: axis(dim(1), label("Job Category") )
ELEMENT: point.dodge.asymmetric(position(bin.dot(jobcat)))
GRAPH: end()
GRAPH: begin(origin(57.5%, 0%), scale(42.5%, 75%))
DATA: educ = col(source(s), name("educ") , unit.category())
GUIDE: axis(dim(1), label("Education") )
ELEMENT: point.dodge.asymmetric(position(bin.dot(educ)))
GRAPH: end()
PAGE: end()
END GPL.        

BTW, I generated this using the STATS REGRESS PLOT extension command currently being offered as a promotion to early adopters of Statistics 20 and switched the ELEMENT statements to use dot plots instead of scatters.

HTH,

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




From:        Robert Lundqvist <[hidden email]>
To:        [hidden email]
Date:        09/02/2011 06:12 AM
Subject:        [SPSSX-L] Two charts in one diagram?
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




I plan to submit a comment to a magazine where the Discussions corner accepts one chart only. I have got two variables though, and it would be very neat to set up one single chart with two separate dotplots for these separate variables. Stacking them row-wise or using two columns does not matter, the only thing needed is to let the dot plots use two separate x axes. I guess combining two charts could be done with a bit of photoshopping, but there could also be way to achieve it within SPSS. Any suggestions?

Robert
******************
Robert Lundqvist
Norrbotten regional council
Sweden

=====================
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: Two charts in one diagram?

Albert-Jan Roskam
In reply to this post by Robert L
Hello,

You could also use ggplot in R:
http://had.co.nz/ggplot2/geom_point.html
http://had.co.nz/ggplot2/facet_grid.html
 
Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: Robert Lundqvist <[hidden email]>
To: [hidden email]
Sent: Friday, September 2, 2011 2:03 PM
Subject: [SPSSX-L] Two charts in one diagram?

I plan to submit a comment to a magazine where the Discussions corner accepts one chart only. I have got two variables though, and it would be very neat to set up one single chart with two separate dotplots for these separate variables. Stacking them row-wise or using two columns does not matter, the only thing needed is to let the dot plots use two separate x axes. I guess combining two charts could be done with a bit of photoshopping, but there could also be way to achieve it within SPSS. Any suggestions?

Robert
******************
Robert Lundqvist
Norrbotten regional council
Sweden

=====================
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: Two charts in one diagram?

ViAnn Beadle
In reply to this post by Jon K Peck

You can also do this using graph algebra in one chart. No positioning stuff required:

 

GGRAPH

  /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat educ MISSING=LISTWISE REPORTMISSING=NO

  /GRAPHSPEC SOURCE=INLINE.

BEGIN GPL

  SOURCE: s=userSource(id("graphdataset"))

  DATA: jobcat=col(source(s), name("jobcat"), unit.category())

  DATA: educ=col(source(s), name("educ"), unit.category())

  COORD: rect(dim(1))

  ELEMENT: point.dodge.asymmetric(position(bin.dot((jobcat/"Job Category") + (educ/"Education Level"))))

END GPL.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jon K Peck
Sent: Friday, September 02, 2011 8:17 AM
To: [hidden email]
Subject: Re: Two charts in one diagram?

 

You can do this with GPL by using its GRAPH statement.  Here is an example using the employee data.sav file shipped with Statistics.  The tricky part is figuring out how to lay out the charts so that everything fits.  I have also specified the size of the combined charts - here 5 inches wide and 4 inches high.

GGRAPH /GRAPHDATASET NAME="graphdataset"
VARIABLES= jobcat educ
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset") )
PAGE: begin(scale(5.0in, 4.0in))
DATA: jobcat = col(source(s), name("jobcat"), unit.category() )
GRAPH: begin(origin(15.0%, 0%), scale(42.5%, 75%))
GUIDE: axis(dim(1), label("Job Category") )
ELEMENT: point.dodge.asymmetric(position(bin.dot(jobcat)))
GRAPH: end()
GRAPH: begin(origin(57.5%, 0%), scale(42.5%, 75%))
DATA: educ = col(source(s), name("educ") , unit.category())
GUIDE: axis(dim(1), label("Education") )
ELEMENT: point.dodge.asymmetric(position(bin.dot(educ)))
GRAPH: end()
PAGE: end()
END GPL.        

BTW, I generated this using the STATS REGRESS PLOT extension command currently being offered as a promotion to early adopters of Statistics 20 and switched the ELEMENT statements to use dot plots instead of scatters.

HTH,

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




From:        Robert Lundqvist <[hidden email]>
To:        [hidden email]
Date:        09/02/2011 06:12 AM
Subject:        [SPSSX-L] Two charts in one diagram?
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





I plan to submit a comment to a magazine where the Discussions corner accepts one chart only. I have got two variables though, and it would be very neat to set up one single chart with two separate dotplots for these separate variables. Stacking them row-wise or using two columns does not matter, the only thing needed is to let the dot plots use two separate x axes. I guess combining two charts could be done with a bit of photoshopping, but there could also be way to achieve it within SPSS. Any suggestions?

Robert
******************
Robert Lundqvist
Norrbotten regional council
Sweden

=====================
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: Two charts in one diagram?

Albert-Jan Roskam
In reply to this post by Robert L
I meant something like this: http://imageshack.us/photo/my-images/155/graphgl.png/
You can use this R code:
df <- data.frame(fac=round(runif(1000)), v1=abs(rnorm(1000)), v2=qnorm(runif(1000), 1000, 1000))
require(ggplot2)
df$fac <- ifelse(df$fac==0, "group 1", "group 2")
ggplot(df, aes(v1, v2)) + geom_point(aes(colour = fac)) + facet_grid(. ~ fac) +  opts(title="Some graph\n")
ggsave(filename=file.path(Sys.getenv()[["TEMP"]], "mygraph.png"), scale=2)

Pretty neat innit?
 
Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: Robert Lundqvist <[hidden email]>
To: [hidden email]
Sent: Friday, September 2, 2011 2:03 PM
Subject: [SPSSX-L] Two charts in one diagram?

I plan to submit a comment to a magazine where the Discussions corner accepts one chart only. I have got two variables though, and it would be very neat to set up one single chart with two separate dotplots for these separate variables. Stacking them row-wise or using two columns does not matter, the only thing needed is to let the dot plots use two separate x axes. I guess combining two charts could be done with a bit of photoshopping, but there could also be way to achieve it within SPSS. Any suggestions?

Robert
******************
Robert Lundqvist
Norrbotten regional council
Sweden

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

Automatic reply: Two charts in one diagram?

Looman, Wendy

I am out of the office September 5, 2011 through September 9, 2011. If you need assistance prior to September 12th, please contact: David M. Bass, Vice President for Research, Benjamin Rose Institute on Aging, Margaret Blenkner Research Institute, 11900 Fairhill Road, #300, Cleveland, OH 44120-1053. Phone: 216-373-1664. Email: [hidden email]

 

If your message concerns the HHCAHPS surveys, please contact: Sue Ambro, Benjamin Rose Institute on Aging, Margaret Blenkner Research Institute, 11900 Fairhill Road, Suite 300, Cleveland, OH 44120-1053. Phone: 216-373-1667. Email: [hidden email]

-----------------------------------------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: The documents accompanying this email may contain confidential information, which is legally privileged. This information is intended only for the use of the recipient named above. If you are not the addressee or the employee or agent of the intended recipient, you are hereby notified that you are strictly prohibited from printing, storing, disseminating, distributing, or copying this communication. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer.
-----------------------------------------------------------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Two charts in one diagram?

ViAnn Beadle
In reply to this post by Albert-Jan Roskam

Easily done with GPL without having to resort to R.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Albert-Jan Roskam
Sent: Friday, September 02, 2011 2:39 PM
To: [hidden email]
Subject: Re: Two charts in one diagram?

 

You can use this R code:

df <- data.frame(fac=round(runif(1000)), v1=abs(rnorm(1000)), v2=qnorm(runif(1000), 1000, 1000))
require(ggplot2)
df$fac <- ifelse(df$fac==0, "group 1", "group 2")
ggplot(df, aes(v1, v2)) + geom_point(aes(colour = fac)) + facet_grid(. ~ fac) +  opts(title="Some graph\n")
ggsave(filename=file.path(Sys.getenv()[["TEMP"]], "mygraph.png"), scale=2)

Pretty neat innit?

 

Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


From: Robert Lundqvist <[hidden email]>
To: [hidden email]
Sent: Friday, September 2, 2011 2:03 PM
Subject: [SPSSX-L] Two charts in one diagram?

I plan to submit a comment to a magazine where the Discussions corner accepts one chart only. I have got two variables though, and it would be very neat to set up one single chart with two separate dotplots for these separate variables. Stacking them row-wise or using two columns does not matter, the only thing needed is to let the dot plots use two separate x axes. I guess combining two charts could be done with a bit of photoshopping, but there could also be way to achieve it within SPSS. Any suggestions?

Robert
******************
Robert Lundqvist
Norrbotten regional council
Sweden

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