+dnl PSPP - a program for statistical analysis.
+dnl Copyright (C) 2017 Free Software Foundation, Inc.
+dnl
+dnl This program is free software: you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation, either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
+dnl
AT_BANNER([GRAPH])
AT_SETUP([GRAPH simple scatterplot])
COMPUTE Size = Age * 3 + 50.
GRAPH
- /SCATTERPLOT(BIVARIATE) = Age WITH Size.
+ /SCATTERPLOT(BIVARIATE) = Age WITH Size.
])
AT_SETUP([GRAPH Scatter and Histogram])
+AT_KEYWORDS([slow])
AT_DATA([scatterlong.sps],[
NEW FILE.
INPUT PROGRAM.
STRING City (a20).
-Recode CityNum
+Recode CityNum
(0 = "Madrid")
(1 = "Paris")
(ELSE = "Stockholm")
into City.
GRAPH
- /SCATTERPLOT(BIVARIATE) = Age WITH Size
+ /SCATTERPLOT(BIVARIATE) = Age WITH Size
GRAPH
/SCATTERPLOT(BIVARIATE) = Age WITH CityNum
-
+
GRAPH
/SCATTERPLOT = CityNum WITH Age
GRAPH
/SCATTERPLOT(BIVARIATE) = Age WITH Size BY CityNum
- ADD VALUE LABELS
+ ADD VALUE LABELS
/CityNum 1 'Rio' 2 'Tokyo' 0 'Mumbai'.
GRAPH
])
-AT_CHECK([pspp -O format=pdf scatterlong.sps], [0], [ignore])
+AT_CHECK([pspp -O format=pdf scatterlong.sps], [0], [ignore], [ignore])
AT_CLEANUP
AT_SETUP([GRAPH missing values don't crash])
5 .
6 1
end data.
-graph
+graph
/scatterplot = x with y.
graph
- /histogram = x.
+ /histogram = x.
])
-AT_CHECK([pspp -o pspp.pdf scatter.sps])
+AT_CHECK([pspp -o pspp.pdf scatter.sps], [], [ignore])
dnl Ignore output -- this is just a no-crash check.
AT_CLEANUP
5 .
6 1
end data.
-graph
+graph
/scatterplot = x with y
/missing = VARIABLE.
graph
/histogram = x
/missing = VARIABLE.
])
-AT_CHECK([pspp -o pspp.pdf scatter.sps])
+AT_CHECK([pspp -o pspp.pdf scatter.sps], [], [ignore])
dnl Ignore output -- this is just a no-crash check.
AT_CLEANUP
5 . 8
6 1 8
end data.
-graph
+graph
/scatterplot = x with y by z
/missing = VARIABLE.
-graph
+graph
/scatterplot = x with y by z.
])
-AT_CHECK([pspp -o pspp.pdf scatter.sps])
+AT_CHECK([pspp -o pspp.pdf scatter.sps], [0], [ignore])
+dnl Ignore output -- this is just a no-crash check.
+AT_CLEANUP
+
+
+AT_SETUP([GRAPH histogram with null data])
+AT_DATA([null-hist.sps], [dnl
+data list list /x *.
+begin data.
+1109
+.
+end data.
+
+graph
+ /histogram = x.
+
+])
+
+AT_CHECK([pspp -o pspp.pdf null-hist.sps], [0], [ignore])
+dnl Ignore output -- this is just a no-crash check.
+AT_CLEANUP
+
+
+AT_SETUP([GRAPH histogram all missing])
+AT_DATA([null-hist.sps], [dnl
+data list list /x *.
+begin data.
+.
+end data.
+
+graph
+ /histogram = x.
+
+])
+
+AT_CHECK([pspp null-hist.sps], [0], [ignore])
dnl Ignore output -- this is just a no-crash check.
AT_CLEANUP
+
+
+AT_SETUP([GRAPH barcharts])
+AT_CHECK([ln -s $top_srcdir/examples/physiology.sav .], [0])
+AT_CHECK([ln -s $top_srcdir/examples/repairs.sav .], [0])
+
+AT_DATA([barchart.sps], [dnl
+GET FILE="physiology.sav".
+
+GRAPH /BAR = COUNT BY SEX.
+
+GRAPH /BAR = MEAN(height) BY SEX.
+
+NEW FILE.
+
+GET FILE="repairs.sav".
+
+GRAPH /BAR = MEAN (mtbf) BY factory.
+
+COMPUTE R = TRUNC(RV.UNIFORM(1,5)).
+
+GRAPH /BAR = MEAN (mtbf) BY factory BY R.
+])
+
+AT_CHECK([pspp -o pspp.pdf barchart.sps], [0], [ignore])
+dnl Ignore output -- this is just a no-crash check.
+
+AT_CLEANUP
+
+
+
+AT_SETUP([GRAPH barchart arity])
+
+AT_DATA([barchart.sps], [dnl
+data list notable list /x y z*.
+begin data
+1 1 3
+2 1 4
+3 1 3
+4 1 4
+5 . 3
+6 2 4
+7 2 3
+8 2 4
+9 2 3
+10 2 4
+end data.
+
+* This line is invalid
+GRAPH /BAR = COUNT(x) BY y.
+])
+
+AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
+dnl Ignore output -- this is just a no-crash check.
+
+AT_CLEANUP
+
+
+
+
+AT_SETUP([GRAPH barchart bad syntax])
+
+AT_DATA([barchart.sps], [dnl
+data list notable list /x y z*.
+begin data
+1 1 3
+2 1 4
+3 1 3
+4 1 4
+5 . 3
+6 2 4
+7 2 3
+8 2 4
+9 2 3
+10 2 4
+end data.
+
+* This line is invalid
+GRAPH /BAR = SCROD BY y.
+])
+
+AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
+dnl Ignore output -- this is just a no-crash check.
+
+AT_CLEANUP
+
+
+
+AT_SETUP([GRAPH barchart full])
+
+AT_DATA([barchart.sps], [dnl
+data list notable list /x y z*.
+begin data
+1 1 3
+2 1 4
+3 1 3
+4 1 4
+5 . 3
+6 2 4
+7 2 3
+8 2 4
+9 2 3
+10 2 4
+end data.
+
+* This line is invalid
+GRAPH /BAR = COUNT by z.
+GRAPH /BAR = CUFREQ by z.
+GRAPH /BAR = PCT by z.
+GRAPH /BAR = CUPCT by z.
+
+GRAPH /BAR = MEAN(y) BY z.
+GRAPH /BAR = SUM(y) BY z.
+GRAPH /BAR = MAXIMUM(y) BY z.
+GRAPH /BAR = MINIMUM(y) BY z.
+
+GRAPH /BAR = MEAN(y) BY z BY y.
+GRAPH /BAR = SUM(y) BY z BY y.
+GRAPH /BAR = MAXIMUM(y) BY z BY y.
+GRAPH /BAR = MINIMUM(y) BY z BY y.
+])
+
+AT_CHECK([pspp -o pspp.pdf barchart.sps], [0], [ignore])
+dnl Ignore output -- this is just a no-crash check.
+
+AT_CLEANUP
+
+
+
+
+
+AT_SETUP([GRAPH buggy syntax])
+
+AT_DATA([barchart.sps], [dnl
+data list notable list /x y z*.
+begin data
+1 1 3
+2 1 4
+10 2 4
+end data.
+
+GRAPH /BAR = MINIMUM({) BY z BY y.
+])
+
+AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
+dnl Ignore output -- this is just a no-crash check.
+
+AT_CLEANUP
+
+
+dnl Check that percentages are calculated with respect to the
+dnl proper total. See bug #56247
+AT_SETUP([GRAPH barchart percentage sub-categorical])
+AT_DATA([barchart.sps], [dnl
+data list list notable /penalty_favopp_x * XYdem_racethW8 * w *.
+begin data.
+1 0 1960
+1 1 376
+2 0 678
+2 1 147
+4 0 368
+4 1 164
+5 0 427
+5 1 274
+. . 1522
+end data.
+
+weight by w.
+
+* crosstabs
+* /tables=penalty_favopp_x by XYdem_racethW8
+* /format=AVALUE TABLES PIVOT
+* /statistics=CHISQ
+* /cells COUNT COLUMN TOTAL.
+
+graph
+ /bar=pct by penalty_favopp_x
+ .
+
+graph
+ /bar=pct by penalty_favopp_x by XYdem_racethW8
+ .
+])
+
+AT_CHECK([pspp --testing barchart.sps], [0], [dnl
+Graphic: Barchart
+Percentage: 0
+Total Categories: 4
+Primary Categories: 4
+Largest Category: 53.1634
+Total Count: 100
+Y Label: "Percentage"
+Categorical Variables:
+ Var: "penalty_favopp_x"
+Categories:
+ 0 " 1.00"
+ 1 " 2.00"
+ 2 " 4.00"
+ 3 " 5.00"
+All Categories:
+Count: 53.1634; Cat: " 1.00"
+Count: 18.7756; Cat: " 2.00"
+Count: 12.1074; Cat: " 4.00"
+Count: 15.9536; Cat: " 5.00"
+
+Graphic: Barchart
+Percentage: 0
+Total Categories: 8
+Primary Categories: 4
+Largest Category: 57.0929
+Total Count: 200
+Y Label: "Percentage"
+Categorical Variables:
+ Var: "penalty_favopp_x"
+ Var: "XYdem_racethW8"
+Categories:
+ 0 " 1.00"
+ 1 " 2.00"
+ 2 " 4.00"
+ 3 " 5.00"
+Sub-categories:
+ 0 " .00"
+ 1 " 1.00"
+All Categories:
+Count: 57.0929; Cat: " 1.00", " .00"
+Count: 39.1259; Cat: " 1.00", " 1.00"
+Count: 19.7495; Cat: " 2.00", " .00"
+Count: 15.2966; Cat: " 2.00", " 1.00"
+Count: 10.7195; Cat: " 4.00", " .00"
+Count: 17.0656; Cat: " 4.00", " 1.00"
+Count: 12.4381; Cat: " 5.00", " .00"
+Count: 28.512; Cat: " 5.00", " 1.00"
+
+])
+
+AT_CLEANUP