Something simple first. The reference is the v24 GPL manual, page 366, scatterplot matricx. I want to understand how the code works. The code has two sections that appear to be the same except for the source statements and the difference is “csvsource” versus
‘usersource”. The explanation of csvsource is cryptic. Why are there two sections?
More importantly, the scatterplot matrix main diagonal appears to be a 1 dimensional scatterplot for each variable as is shown in an earlier example. Where is the command that puts that scatterplot in the matrix main diagonal?
That was the warmup. Is something like this possible? (An image would be exquisitely informative but the listserv won’t accept a png image.) So, consider a scatterplot matrix with four variables.
Main diagonal: variable frequency distribution plus variable name or label.
Lower triangle: scatterplots with fit line. Upper triangle: Correlations but with font size scaled to corr magnitude
Lastly, cell x and y response scales placed on the row and column sub-rectangles.
Compact, isn’t it. Gene Maguin |
It's kind of pointless to have both blocks of code - it's that way for every example - but the userSource form is what you get from the ChartBuilder. This is not so obvious, because the examples don't show the GGRAPH code. You could run these examples from csv files rather than within Statistics using the second form of the code. The example dataset is included in the samples folder under your Statistics installation (in sav form), so you can reproduce this yourself. The complete code from the Chart Builder is pasted below. You can see from this more obviously how the variable labels are brought into play and referenced in the ELEMENT statement. Now, the form of the position function in the ELEMENT statement has three variables * the same three variables. Each is plotted against the other three, which is why the diagonals look the way they do. In other words, the specification is really just (x+y+z) * (x+y+z) where "+" here is meant in the GPL algebra sense. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=age creddebt income MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE /FITLINE TOTAL=NO. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: age=col(source(s), name("age")) DATA: creddebt=col(source(s), name("creddebt")) DATA: income=col(source(s), name("income")) GUIDE: axis(dim(1.1), ticks(null())) GUIDE: axis(dim(2.1), ticks(null())) GUIDE: axis(dim(1), gap(0px)) GUIDE: axis(dim(2), gap(0px)) GUIDE: text.title(label("Scatterplot Matrix Age in years,Credit card debt in ", "thousands,Household income in thousands")) TRANS: age_label = eval("Age in years") TRANS: creddebt_label = eval("Credit card debt in thousands") TRANS: income_label = eval("Household income in thousands") ELEMENT: point(position((age/age_label+creddebt/creddebt_label+income/income_label)* (age/age_label+creddebt/creddebt_label+income/income_label))) END GPL. On Mon, Feb 11, 2019 at 1:15 PM Maguin, Eugene <[hidden email]> wrote:
|
Thank you for your reply. I would never have guessed even though I look at the reference to see how to do things.
Is it possible to put histograms in the main diagonal? I’m looking at the reference now and I see that for single scatterplots histograms or boxplots can be put
on the border and I see how that is done (p 371). Gene Maguin From: Jon Peck <[hidden email]>
It's kind of pointless to have both blocks of code - it's that way for every example - but the userSource form is what you get from the ChartBuilder. This is not so obvious, because the examples don't show
the GGRAPH code. You could run these examples from csv files rather than within Statistics using the second form of the code. The example dataset is included in the samples folder under your Statistics installation (in sav form), so you can reproduce this
yourself. The complete code from the Chart Builder is pasted below. You can see from this more obviously how the variable labels are brought into play and referenced in the ELEMENT statement. Now, the form of the position function in the ELEMENT statement has three variables * the same three variables. Each is plotted against the other three, which is why the diagonals look the way they do. In
other words, the specification is really just (x+y+z) * (x+y+z) where "+" here is meant in the GPL algebra sense. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=age creddebt income MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE /FITLINE TOTAL=NO. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: age=col(source(s), name("age")) DATA: creddebt=col(source(s), name("creddebt")) DATA: income=col(source(s), name("income")) GUIDE: axis(dim(1.1), ticks(null())) GUIDE: axis(dim(2.1), ticks(null())) GUIDE: axis(dim(1), gap(0px)) GUIDE: axis(dim(2), gap(0px)) GUIDE: text.title(label("Scatterplot Matrix Age in years,Credit card debt in ", "thousands,Household income in thousands")) TRANS: age_label = eval("Age in years") TRANS: creddebt_label = eval("Credit card debt in thousands") TRANS: income_label = eval("Household income in thousands") ELEMENT: point(position((age/age_label+creddebt/creddebt_label+income/income_label)* (age/age_label+creddebt/creddebt_label+income/income_label))) END GPL. On Mon, Feb 11, 2019 at 1:15 PM Maguin, Eugene <[hidden email]> wrote:
-- Jon K Peck |
Well, using GPL you can compose a chart that is made up of a bunch of other charts (the STATS REGRESS PLOTS and STATS SUBGROUP PLOTS do this), but it can be rather difficult to lay these out. However, go to Graphs > Graphboard Template Chooser. Then select at least two scale variables and pick the splom from the charts offered. You get ugly syntax like that below, but you get a scatterplot matrix with histograms on the diagonals. You have a lot of choices on details on the "Detailed" tab. Although this is a completely different interface and does not use GPL, it actually uses the same graphing engine. Double clicking the output brings up a different chart editor that mainly focuses on presentation details. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=prevexp[LEVEL=scale] salary[LEVEL=scale] salbegin[LEVEL=scale] MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=VIZTEMPLATE(NAME="Scatterplot Matrix (SPLOM)"[LOCATION=LOCAL] MAPPING( "all"="salary"[DATASET="graphdataset"] "all"="prevexp"[DATASET="graphdataset"] "all"="salbegin"[DATASET="graphdataset"])) VIZSTYLESHEET="Traditional"[LOCATION=LOCAL] LABEL='SCATTERPLOT MATRIX (SPLOM): prevexp-salbegin-salary' DEFAULTTEMPLATE=NO. On Mon, Feb 11, 2019 at 2:33 PM Maguin, Eugene <[hidden email]> wrote:
|
Jon,
First, about the GPL syntax for a scatterplot matrix. I’m still not getting anything in the main diagonal. I had (finally) figured out how to use the Chart Builder
and had made a matrix and then gone on to look in the reference to see what else could be done, all before I posted. Anyway, I’m not getting anything in the main diagonal. I don’t know why but let’s move on.
I ran the graphboard??, is that where it came from, syntax you sent and like what I got. Thank you. A question: how do I add a fit line for each plot?
Gene Maguin From: Jon Peck <[hidden email]>
Well, using GPL you can compose a chart that is made up of a bunch of other charts (the STATS REGRESS PLOTS and STATS SUBGROUP PLOTS do this), but it can be rather difficult to lay these out. However, go to Graphs > Graphboard Template Chooser. Then select at least two scale variables and pick the splom from the charts offered. You get ugly syntax like that below, but you get a scatterplot matrix
with histograms on the diagonals. You have a lot of choices on details on the "Detailed" tab. Although this is a completely different interface and does not use GPL, it actually uses the same graphing engine. Double clicking the output brings up a different chart editor that mainly focuses on presentation
details. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=prevexp[LEVEL=scale] salary[LEVEL=scale] salbegin[LEVEL=scale] MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=VIZTEMPLATE(NAME="Scatterplot Matrix (SPLOM)"[LOCATION=LOCAL] MAPPING( "all"="salary"[DATASET="graphdataset"] "all"="prevexp"[DATASET="graphdataset"] "all"="salbegin"[DATASET="graphdataset"])) VIZSTYLESHEET="Traditional"[LOCATION=LOCAL] LABEL='SCATTERPLOT MATRIX (SPLOM): prevexp-salbegin-salary' DEFAULTTEMPLATE=NO. On Mon, Feb 11, 2019 at 2:33 PM Maguin, Eugene <[hidden email]> wrote:
-- Jon K Peck |
As far as I know, there is no way to get a fit line on the charts in a SPLOM from the Graphboard Template Chooser. It might be possible to tinker with that template, however. On Tue, Feb 12, 2019 at 8:40 AM Maguin, Eugene <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |