GPL: reverse brightness into darkness

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

GPL: reverse brightness into darkness

Kirill Orlov
GPL color.brightness allows to show values by rightness of a colour. For example,

ELEMENT: point(position(x*y), color.brightness(Z), color(color.grey))

shows points in grey, the brightness of the grey being defined by values of some variable Z. The greater is Z the lightgter is the colour.

I want to reverse it: the greater is Z the darker is the colour. This simple

ELEMENT: point(position(x*y), color.brightness(-Z), color(color.grey))
or
ELEMENT: point(position(x*y), color.brightness(eval(-Z)), color(color.grey))
does not work.

Can you help?

Please note that I cannot negate (or anyhow convert) the Z variable's values in the variable itself, in the dataset, prior the GGRAPH command, because I want the legend on the graph relate the original Z's values.

===================== 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: reverse brightness into darkness

PRogman
The Z parameter has a range 0..1, from darkest to brightest. If your data is
scaled to this range you can reverse it prior to invoking GGRAPH (revZ =
1-Z), or you could manually add a TRANS: revZ = eval(1-Z), and change all
occurences of Z to revZ in the following GPL code.
HTH, PR

*****.
PRESERVE.
SET DECIMAL=DOT.

DATA LIST LIST/
X Y Z (2F8.0 F8.2).
BEGIN DATA
1 1 0.00
2 1 0.25
3 1 0.50
4 1 0.75
5 1 1.00
END DATA.

RESTORE.
EXECUTE.

GGRAPH
  /GRAPHDATASET
   NAME="graphdataset"
   VARIABLES=X Y Z
   MISSING=LISTWISE
   REPORTMISSING=NO
  /GRAPHSPEC
   SOURCE=INLINE
  /FITLINE
   TOTAL=NO.
BEGIN GPL
  SOURCE:  s=userSource(id("graphdataset"))
  DATA:    X=col(source(s), name("X"))
  DATA:    Y=col(source(s), name("Y"))
  DATA:    Z=col(source(s), name("Z"))
  TRANS:   revZ = eval(1 - Z)
  GUIDE:   axis(dim(1), label("X"))
  GUIDE:   axis(dim(2), label("Y"))
  ELEMENT: point(position(X*Y)
                ,size(size."100")
                ,color.interior(color.blue)
                ,color.brightness(revZ)
                )
END GPL.
*****.



Kirill Orlov wrote

> GPL color.brightness allows to show values by rightness of a colour. For
> example,
>
> ELEMENT: point(position(x*y), color.brightness(Z), color(color.grey))
>
> shows points in grey, the brightness of the grey being defined by values
> of some variable Z. The greater is Z the lightgter is the colour.
>
> I want to reverse it: the greater is Z *the darker* is the colour. This
> simple
>
> ELEMENT: point(position(x*y), color.brightness(-Z), color(color.grey))
> or
> ELEMENT: point(position(x*y), color.brightness(eval(-Z)),
> color(color.grey))
> does not work.
>
> Can you help?
>
> Please note that I cannot negate (or anyhow convert) the Z variable's
> values in the variable itself, in the dataset, prior the GGRAPH command,
> because I want the legend on the graph relate the original Z's values.
>
>
> =====================
> 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





--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: GPL: reverse brightness into darkness

Kirill Orlov
According to GPL Guide,

color.brightness(<algebra>)
or
color.brightness(color.brightness."brightness value")
or
color.brightness(<statistic function>)

<algebra> or <statistic function> needs not to be in the range 0-1, so Z
variable may have any numeric values.

The TRANS - that could be solution, perhaps.
I will wait for alternative solutions, if any.

Thank you.


26.11.2020 16:33, PRogman пишет:
> The Z parameter has a range 0..1, from darkest to brightest. If your data is
> scaled to this range you can reverse it prior to invoking GGRAPH (revZ =
> 1-Z), or you could manually add a TRANS: revZ = eval(1-Z), and change all
> occurences of Z to revZ in the following GPL code.
> HTH, PR
>

=====================
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: reverse brightness into darkness

PRogman
I think all values going into the brightness value are scaled into the 0..1
range. Empirically looks that way...
In the case of reversal you will have to reverse the scale with MAX(Z) in
syntax as max() is not supported by eval() (I think).

/PR



Kirill Orlov wrote

> According to GPL Guide,
>
> color.brightness(
> <algebra>
> )
> or
> color.brightness(color.brightness."brightness value")
> or
> color.brightness(
> <statistic function>
> )
> <algebra>
>  or
> <statistic function>
>  needs not to be in the range 0-1, so Z
> variable may have any numeric values.
>
> The TRANS - that could be solution, perhaps.
> I will wait for alternative solutions, if any.
>
> Thank you.
>
>
> 26.11.2020 16:33, PRogman пишет:
>> The Z parameter has a range 0..1, from darkest to brightest. If your data
>> is
>> scaled to this range you can reverse it prior to invoking GGRAPH (revZ =
>> 1-Z), or you could manually add a TRANS: revZ = eval(1-Z), and change all
>> occurences of Z to revZ in the following GPL code.
>> HTH, PR
>>
>
> =====================
> 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





--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: GPL: reverse brightness into darkness

Jon Peck
In reply to this post by PRogman
You can just negate the brightness variable and leave it the brightness function for scaling
  TRANS: z = eval(-z)

I think that z can't be a categorical variable in the GPL code, however.

On Thu, Nov 26, 2020 at 6:33 AM PRogman <[hidden email]> wrote:
The Z parameter has a range 0..1, from darkest to brightest. If your data is
scaled to this range you can reverse it prior to invoking GGRAPH (revZ =
1-Z), or you could manually add a TRANS: revZ = eval(1-Z), and change all
occurences of Z to revZ in the following GPL code.
HTH, PR

*****.
PRESERVE.
SET DECIMAL=DOT.

DATA LIST LIST/
X Y Z (2F8.0 F8.2).
BEGIN DATA
1 1 0.00
2 1 0.25
3 1 0.50
4 1 0.75
5 1 1.00
END DATA.

RESTORE.
EXECUTE.

GGRAPH
  /GRAPHDATASET
   NAME="graphdataset"
   VARIABLES=X Y Z
   MISSING=LISTWISE
   REPORTMISSING=NO
  /GRAPHSPEC
   SOURCE=INLINE
  /FITLINE
   TOTAL=NO.
BEGIN GPL
  SOURCE:  s=userSource(id("graphdataset"))
  DATA:    X=col(source(s), name("X"))
  DATA:    Y=col(source(s), name("Y"))
  DATA:    Z=col(source(s), name("Z"))
  TRANS:   revZ = eval(1 - Z)
  GUIDE:   axis(dim(1), label("X"))
  GUIDE:   axis(dim(2), label("Y"))
  ELEMENT: point(position(X*Y)
                ,size(size."100")
                ,color.interior(color.blue)
                ,color.brightness(revZ)
                )
END GPL.
*****.



Kirill Orlov wrote
> GPL color.brightness allows to show values by rightness of a colour. For
> example,
>
> ELEMENT: point(position(x*y), color.brightness(Z), color(color.grey))
>
> shows points in grey, the brightness of the grey being defined by values
> of some variable Z. The greater is Z the lightgter is the colour.
>
> I want to reverse it: the greater is Z *the darker* is the colour. This
> simple
>
> ELEMENT: point(position(x*y), color.brightness(-Z), color(color.grey))
> or
> ELEMENT: point(position(x*y), color.brightness(eval(-Z)),
> color(color.grey))
> does not work.
>
> Can you help?
>
> Please note that I cannot negate (or anyhow convert) the Z variable's
> values in the variable itself, in the dataset, prior the GGRAPH command,
> because I want the legend on the graph relate the original Z's values.
>
>
> =====================
> 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





--
Sent from: http://spssx-discussion.1045642.n5.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


--
Jon K Peck
[hidden email]

===================== 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: reverse brightness into darkness

Kirill Orlov
TRANS: neg_Z = eval(-Z)
does the job
but unfortunately the values displayed on the legend also negate. I have a legend.
Below is my example with a heatmap.


data list list  /row    col    val.
begin data
v1       v1         1.0000
v1       v2          .7035
v1       v3          .1502
v1       v4         -.2993
v1       v5          .2041
v1       v6         1.0000
v1       v7         -.1502
v1       v8          .0000
v1       v9          .0000
v1       v10         .0000
v1       v11         .0000
v1       v12        -.1021
v1       v13        -.1601
v1       v14        -.1601
v1       v15         .1601
v1       v16         .1601
v1       v17        -.0949
v1       v18        -.2294
v1       v19         .0949
v1       v20        -.0599
v2       v1          .7035
v2       v2         1.0000
v2       v3         -.0453
v2       v4         -.2347
v2       v5          .2872
v2       v6          .7035
v2       v7          .0453
v2       v8          .0000
v2       v9          .0000
v2       v10         .0000
v2       v11         .0000
v2       v12        -.0821
v2       v13         .1448
v2       v14         .1448
v2       v15         .1770
v2       v16         .1770
v2       v17        -.1240
v2       v18        -.2536
v2       v19         .1240
v2       v20        -.1143
v3       v1          .1502
v3       v2         -.0453
v3       v3         1.0000
v3       v4         -.1529
v3       v5          .0613
v3       v6          .1502
v3       v7        -1.0000
v3       v8          .0000
v3       v9          .0000
v3       v10         .0000
v3       v11         .0000
v3       v12        -.1635
v3       v13        -.1523
v3       v14        -.1523
v3       v15         .1523
v3       v16         .1523
v3       v17         .1093
v3       v18         .0115
v3       v19         .0808
v3       v20         .2068
v4       v1         -.2993
v4       v2         -.2347
v4       v3         -.1529
v4       v4         1.0000
v4       v5         -.1711
v4       v6         -.2993
v4       v7          .1529
v4       v8          .0000
v4       v9          .0000
v4       v10         .0000
v4       v11         .0000
v4       v12         .0489
v4       v13        -.0863
v4       v14        -.0863
v4       v15        -.2972
v4       v16        -.2972
v4       v17         .0739
v4       v18         .1511
v4       v19        -.0739
v4       v20        -.1470
v5       v1          .2041
v5       v2          .2872
v5       v3          .0613
v5       v4         -.1711
v5       v5         1.0000
v5       v6          .2041
v5       v7         -.0613
v5       v8          .0000
v5       v9          .0000
v5       v10         .0000
v5       v11         .0000
v5       v12         .0417
v5       v13         .1307
v5       v14         .1307
v5       v15         .1961
v5       v16         .1961
v5       v17         .0387
v5       v18        -.0468
v5       v19         .1550
v5       v20        -.0489
v6       v1         1.0000
v6       v2          .7035
v6       v3          .1502
v6       v4         -.2993
v6       v5          .2041
v6       v6         1.0000
v6       v7         -.1502
v6       v8          .0000
v6       v9          .0000
v6       v10         .0000
v6       v11         .0000
v6       v12        -.1021
v6       v13        -.1601
v6       v14        -.1601
v6       v15         .1601
v6       v16         .1601
v6       v17        -.0949
v6       v18        -.2294
v6       v19         .0949
v6       v20        -.0599
v7       v1         -.1502
v7       v2          .0453
v7       v3        -1.0000
v7       v4          .1529
v7       v5         -.0613
v7       v6         -.1502
v7       v7         1.0000
v7       v8          .0000
v7       v9          .0000
v7       v10         .0000
v7       v11         .0000
v7       v12         .1635
v7       v13         .1523
v7       v14         .1523
v7       v15        -.1523
v7       v16        -.1523
v7       v17        -.1093
v7       v18        -.0115
v7       v19        -.0808
v7       v20        -.2068
v8       v1          .0000
v8       v2          .0000
v8       v3          .0000
v8       v4          .0000
v8       v5          .0000
v8       v6          .0000
v8       v7          .0000
v8       v8         1.0000
v8       v9          .0000
v8       v10         .0000
v8       v11         .0000
v8       v12         .0000
v8       v13         .0000
v8       v14         .0000
v8       v15         .0000
v8       v16         .0000
v8       v17         .0000
v8       v18         .0000
v8       v19         .0000
v8       v20         .0000
v9       v1          .0000
v9       v2          .0000
v9       v3          .0000
v9       v4          .0000
v9       v5          .0000
v9       v6          .0000
v9       v7          .0000
v9       v8          .0000
v9       v9         1.0000
v9       v10         .0000
v9       v11         .0000
v9       v12         .0000
v9       v13         .0000
v9       v14         .0000
v9       v15         .0000
v9       v16         .0000
v9       v17         .0000
v9       v18         .0000
v9       v19         .0000
v9       v20         .0000
v10      v1          .0000
v10      v2          .0000
v10      v3          .0000
v10      v4          .0000
v10      v5          .0000
v10      v6          .0000
v10      v7          .0000
v10      v8          .0000
v10      v9          .0000
v10      v10        1.0000
v10      v11         .0000
v10      v12         .0000
v10      v13         .0000
v10      v14         .0000
v10      v15         .0000
v10      v16         .0000
v10      v17         .0000
v10      v18         .0000
v10      v19         .0000
v10      v20         .0000
v11      v1          .0000
v11      v2          .0000
v11      v3          .0000
v11      v4          .0000
v11      v5          .0000
v11      v6          .0000
v11      v7          .0000
v11      v8          .0000
v11      v9          .0000
v11      v10         .0000
v11      v11        1.0000
v11      v12         .0000
v11      v13         .0000
v11      v14         .0000
v11      v15         .0000
v11      v16         .0000
v11      v17         .0000
v11      v18         .0000
v11      v19         .0000
v11      v20         .0000
v12      v1         -.1021
v12      v2         -.0821
v12      v3         -.1635
v12      v4          .0489
v12      v5          .0417
v12      v6         -.1021
v12      v7          .1635
v12      v8          .0000
v12      v9          .0000
v12      v10         .0000
v12      v11         .0000
v12      v12        1.0000
v12      v13        -.1307
v12      v14        -.1307
v12      v15         .1307
v12      v16         .1307
v12      v17        -.0387
v12      v18         .0468
v12      v19        -.1550
v12      v20        -.0733
v13      v1         -.1601
v13      v2          .1448
v13      v3         -.1523
v13      v4         -.0863
v13      v5          .1307
v13      v6         -.1601
v13      v7          .1523
v13      v8          .0000
v13      v9          .0000
v13      v10         .0000
v13      v11         .0000
v13      v12        -.1307
v13      v13        1.0000
v13      v14        1.0000
v13      v15         .0256
v13      v16         .0256
v13      v17        -.0456
v13      v18        -.0367
v13      v19         .0456
v13      v20        -.0863
v14      v1         -.1601
v14      v2          .1448
v14      v3         -.1523
v14      v4         -.0863
v14      v5          .1307
v14      v6         -.1601
v14      v7          .1523
v14      v8          .0000
v14      v9          .0000
v14      v10         .0000
v14      v11         .0000
v14      v12        -.1307
v14      v13        1.0000
v14      v14        1.0000
v14      v15         .0256
v14      v16         .0256
v14      v17        -.0456
v14      v18        -.0367
v14      v19         .0456
v14      v20        -.0863
v15      v1          .1601
v15      v2          .1770
v15      v3          .1523
v15      v4         -.2972
v15      v5          .1961
v15      v6          .1601
v15      v7         -.1523
v15      v8          .0000
v15      v9          .0000
v15      v10         .0000
v15      v11         .0000
v15      v12         .1307
v15      v13         .0256
v15      v14         .0256
v15      v15        1.0000
v15      v16        1.0000
v15      v17         .0456
v15      v18         .0367
v15      v19        -.0456
v15      v20         .0863
v16      v1          .1601
v16      v2          .1770
v16      v3          .1523
v16      v4         -.2972
v16      v5          .1961
v16      v6          .1601
v16      v7         -.1523
v16      v8          .0000
v16      v9          .0000
v16      v10         .0000
v16      v11         .0000
v16      v12         .1307
v16      v13         .0256
v16      v14         .0256
v16      v15        1.0000
v16      v16        1.0000
v16      v17         .0456
v16      v18         .0367
v16      v19        -.0456
v16      v20         .0863
v17      v1         -.0949
v17      v2         -.1240
v17      v3          .1093
v17      v4          .0739
v17      v5          .0387
v17      v6         -.0949
v17      v7         -.1093
v17      v8          .0000
v17      v9          .0000
v17      v10         .0000
v17      v11         .0000
v17      v12        -.0387
v17      v13        -.0456
v17      v14        -.0456
v17      v15         .0456
v17      v16         .0456
v17      v17        1.0000
v17      v18         .8057
v17      v19        -.6396
v17      v20         .3012
v18      v1         -.2294
v18      v2         -.2536
v18      v3          .0115
v18      v4          .1511
v18      v5         -.0468
v18      v6         -.2294
v18      v7         -.0115
v18      v8          .0000
v18      v9          .0000
v18      v10         .0000
v18      v11         .0000
v18      v12         .0468
v18      v13        -.0367
v18      v14        -.0367
v18      v15         .0367
v18      v16         .0367
v18      v17         .8057
v18      v18        1.0000
v18      v19        -.8057
v18      v20         .4258
v19      v1          .0949
v19      v2          .1240
v19      v3          .0808
v19      v4         -.0739
v19      v5          .1550
v19      v6          .0949
v19      v7         -.0808
v19      v8          .0000
v19      v9          .0000
v19      v10         .0000
v19      v11         .0000
v19      v12        -.1550
v19      v13         .0456
v19      v14         .0456
v19      v15        -.0456
v19      v16        -.0456
v19      v17        -.6396
v19      v18        -.8057
v19      v19        1.0000
v19      v20        -.3012
v20      v1         -.0599
v20      v2         -.1143
v20      v3          .2068
v20      v4         -.1470
v20      v5         -.0489
v20      v6         -.0599
v20      v7         -.2068
v20      v8          .0000
v20      v9          .0000
v20      v10         .0000
v20      v11         .0000
v20      v12        -.0733
v20      v13        -.0863
v20      v14        -.0863
v20      v15         .0863
v20      v16         .0863
v20      v17         .3012
v20      v18         .4258
v20      v19        -.3012
v20      v20        1.0000
end data.

*Version original (greater value = lighter).
GGRAPH /GRAPHDATASET NAME= 'graphdataset' VARIABLES= col row val /GRAPHSPEC SOURCE= INLINE.
BEGIN GPL
  PAGE: begin(scale(700px,520px))
  SOURCE: s=userSource(id("graphdataset"))
  DATA: row=col(source(s),name("row"),unit.category())
  DATA: col=col(source(s),name("col"),unit.category())
  DATA: val=col(source(s),name("val"))
  GUIDE: axis(dim(1),label(" "))
  GUIDE: axis(dim(2),label(" "))
  GUIDE: legend(aesthetic(aesthetic.color),label(" "))
  SCALE: cat(dim(1),sort.data())
  SCALE: cat(dim(2),sort.data(),reverse())
  ELEMENT: polygon(position(col*row)),color(color.grey),color.brightness.exterior(val),color.brightness.interior(val))
  PAGE: end()
END GPL.

*Version reverted (greater value = darker).
GGRAPH /GRAPHDATASET NAME= 'graphdataset' VARIABLES= col row val /GRAPHSPEC SOURCE= INLINE.
BEGIN GPL
  PAGE: begin(scale(700px,520px))
  SOURCE: s=userSource(id("graphdataset"))
  DATA: row=col(source(s),name("row"),unit.category())
  DATA: col=col(source(s),name("col"),unit.category())
  DATA: val=col(source(s),name("val"))
     TRANS: val2=eval(-val)
  GUIDE: axis(dim(1),label(" "))
  GUIDE: axis(dim(2),label(" "))
  GUIDE: legend(aesthetic(aesthetic.color),label(" "))
  SCALE: cat(dim(1),sort.data())
  SCALE: cat(dim(2),sort.data(),reverse())
  ELEMENT: polygon(position(col*row)),color(color.grey),color.brightness.exterior(val2),color.brightness.interior(val2))
  PAGE: end()
END GPL.

The problem left with the second one is that the LEGEND corresponds now to VAL2, but I want it to correspond to VAL (i.e. the darkmost must be 1.0, not -1.0)


26.11.2020 17:53, Jon Peck пишет:
You can just negate the brightness variable and leave it the brightness function for scaling
  TRANS: z = eval(-z)

I think that z can't be a categorical variable in the GPL code, however.


===================== 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: reverse brightness into darkness

Jon Peck
How about this.

GGRAPH /GRAPHDATASET NAME= 'graphdataset' VARIABLES= col row val /GRAPHSPEC SOURCE= INLINE.
BEGIN GPL
  PAGE: begin(scale(700px,520px))
  SOURCE: s=userSource(id("graphdataset"))
  DATA: row=col(source(s),name("row"),unit.category())
  DATA: col=col(source(s),name("col"),unit.category())
  DATA: val=col(source(s),name("val"))
  TRANS: val2=eval(-val)
  GUIDE: axis(dim(1),label(" "))
  GUIDE: axis(dim(2),label(" "))
  GUIDE: legend(aesthetic(aesthetic.color.brightness.exterior),null())
  SCALE: cat(dim(1),sort.data())
  SCALE: cat(dim(2),sort.data(),reverse())
  ELEMENT: polygon(position(col*row)),color(color.grey),color.brightness.exterior(val2),color.brightness.interior(val2))
  PAGE: end()
END GPL

On Thu, Nov 26, 2020 at 8:43 AM Kirill Orlov <[hidden email]> wrote:
TRANS: neg_Z = eval(-Z)
does the job
but unfortunately the values displayed on the legend also negate. I have a legend.
Below is my example with a heatmap.


data list list  /row    col    val.
begin data
v1       v1         1.0000
v1       v2          .7035
v1       v3          .1502
v1       v4         -.2993
v1       v5          .2041
v1       v6         1.0000
v1       v7         -.1502
v1       v8          .0000
v1       v9          .0000
v1       v10         .0000
v1       v11         .0000
v1       v12        -.1021
v1       v13        -.1601
v1       v14        -.1601
v1       v15         .1601
v1       v16         .1601
v1       v17        -.0949
v1       v18        -.2294
v1       v19         .0949
v1       v20        -.0599
v2       v1          .7035
v2       v2         1.0000
v2       v3         -.0453
v2       v4         -.2347
v2       v5          .2872
v2       v6          .7035
v2       v7          .0453
v2       v8          .0000
v2       v9          .0000
v2       v10         .0000
v2       v11         .0000
v2       v12        -.0821
v2       v13         .1448
v2       v14         .1448
v2       v15         .1770
v2       v16         .1770
v2       v17        -.1240
v2       v18        -.2536
v2       v19         .1240
v2       v20        -.1143
v3       v1          .1502
v3       v2         -.0453
v3       v3         1.0000
v3       v4         -.1529
v3       v5          .0613
v3       v6          .1502
v3       v7        -1.0000
v3       v8          .0000
v3       v9          .0000
v3       v10         .0000
v3       v11         .0000
v3       v12        -.1635
v3       v13        -.1523
v3       v14        -.1523
v3       v15         .1523
v3       v16         .1523
v3       v17         .1093
v3       v18         .0115
v3       v19         .0808
v3       v20         .2068
v4       v1         -.2993
v4       v2         -.2347
v4       v3         -.1529
v4       v4         1.0000
v4       v5         -.1711
v4       v6         -.2993
v4       v7          .1529
v4       v8          .0000
v4       v9          .0000
v4       v10         .0000
v4       v11         .0000
v4       v12         .0489
v4       v13        -.0863
v4       v14        -.0863
v4       v15        -.2972
v4       v16        -.2972
v4       v17         .0739
v4       v18         .1511
v4       v19        -.0739
v4       v20        -.1470
v5       v1          .2041
v5       v2          .2872
v5       v3          .0613
v5       v4         -.1711
v5       v5         1.0000
v5       v6          .2041
v5       v7         -.0613
v5       v8          .0000
v5       v9          .0000
v5       v10         .0000
v5       v11         .0000
v5       v12         .0417
v5       v13         .1307
v5       v14         .1307
v5       v15         .1961
v5       v16         .1961
v5       v17         .0387
v5       v18        -.0468
v5       v19         .1550
v5       v20        -.0489
v6       v1         1.0000
v6       v2          .7035
v6       v3          .1502
v6       v4         -.2993
v6       v5          .2041
v6       v6         1.0000
v6       v7         -.1502
v6       v8          .0000
v6       v9          .0000
v6       v10         .0000
v6       v11         .0000
v6       v12        -.1021
v6       v13        -.1601
v6       v14        -.1601
v6       v15         .1601
v6       v16         .1601
v6       v17        -.0949
v6       v18        -.2294
v6       v19         .0949
v6       v20        -.0599
v7       v1         -.1502
v7       v2          .0453
v7       v3        -1.0000
v7       v4          .1529
v7       v5         -.0613
v7       v6         -.1502
v7       v7         1.0000
v7       v8          .0000
v7       v9          .0000
v7       v10         .0000
v7       v11         .0000
v7       v12         .1635
v7       v13         .1523
v7       v14         .1523
v7       v15        -.1523
v7       v16        -.1523
v7       v17        -.1093
v7       v18        -.0115
v7       v19        -.0808
v7       v20        -.2068
v8       v1          .0000
v8       v2          .0000
v8       v3          .0000
v8       v4          .0000
v8       v5          .0000
v8       v6          .0000
v8       v7          .0000
v8       v8         1.0000
v8       v9          .0000
v8       v10         .0000
v8       v11         .0000
v8       v12         .0000
v8       v13         .0000
v8       v14         .0000
v8       v15         .0000
v8       v16         .0000
v8       v17         .0000
v8       v18         .0000
v8       v19         .0000
v8       v20         .0000
v9       v1          .0000
v9       v2          .0000
v9       v3          .0000
v9       v4          .0000
v9       v5          .0000
v9       v6          .0000
v9       v7          .0000
v9       v8          .0000
v9       v9         1.0000
v9       v10         .0000
v9       v11         .0000
v9       v12         .0000
v9       v13         .0000
v9       v14         .0000
v9       v15         .0000
v9       v16         .0000
v9       v17         .0000
v9       v18         .0000
v9       v19         .0000
v9       v20         .0000
v10      v1          .0000
v10      v2          .0000
v10      v3          .0000
v10      v4          .0000
v10      v5          .0000
v10      v6          .0000
v10      v7          .0000
v10      v8          .0000
v10      v9          .0000
v10      v10        1.0000
v10      v11         .0000
v10      v12         .0000
v10      v13         .0000
v10      v14         .0000
v10      v15         .0000
v10      v16         .0000
v10      v17         .0000
v10      v18         .0000
v10      v19         .0000
v10      v20         .0000
v11      v1          .0000
v11      v2          .0000
v11      v3          .0000
v11      v4          .0000
v11      v5          .0000
v11      v6          .0000
v11      v7          .0000
v11      v8          .0000
v11      v9          .0000
v11      v10         .0000
v11      v11        1.0000
v11      v12         .0000
v11      v13         .0000
v11      v14         .0000
v11      v15         .0000
v11      v16         .0000
v11      v17         .0000
v11      v18         .0000
v11      v19         .0000
v11      v20         .0000
v12      v1         -.1021
v12      v2         -.0821
v12      v3         -.1635
v12      v4          .0489
v12      v5          .0417
v12      v6         -.1021
v12      v7          .1635
v12      v8          .0000
v12      v9          .0000
v12      v10         .0000
v12      v11         .0000
v12      v12        1.0000
v12      v13        -.1307
v12      v14        -.1307
v12      v15         .1307
v12      v16         .1307
v12      v17        -.0387
v12      v18         .0468
v12      v19        -.1550
v12      v20        -.0733
v13      v1         -.1601
v13      v2          .1448
v13      v3         -.1523
v13      v4         -.0863
v13      v5          .1307
v13      v6         -.1601
v13      v7          .1523
v13      v8          .0000
v13      v9          .0000
v13      v10         .0000
v13      v11         .0000
v13      v12        -.1307
v13      v13        1.0000
v13      v14        1.0000
v13      v15         .0256
v13      v16         .0256
v13      v17        -.0456
v13      v18        -.0367
v13      v19         .0456
v13      v20        -.0863
v14      v1         -.1601
v14      v2          .1448
v14      v3         -.1523
v14      v4         -.0863
v14      v5          .1307
v14      v6         -.1601
v14      v7          .1523
v14      v8          .0000
v14      v9          .0000
v14      v10         .0000
v14      v11         .0000
v14      v12        -.1307
v14      v13        1.0000
v14      v14        1.0000
v14      v15         .0256
v14      v16         .0256
v14      v17        -.0456
v14      v18        -.0367
v14      v19         .0456
v14      v20        -.0863
v15      v1          .1601
v15      v2          .1770
v15      v3          .1523
v15      v4         -.2972
v15      v5          .1961
v15      v6          .1601
v15      v7         -.1523
v15      v8          .0000
v15      v9          .0000
v15      v10         .0000
v15      v11         .0000
v15      v12         .1307
v15      v13         .0256
v15      v14         .0256
v15      v15        1.0000
v15      v16        1.0000
v15      v17         .0456
v15      v18         .0367
v15      v19        -.0456
v15      v20         .0863
v16      v1          .1601
v16      v2          .1770
v16      v3          .1523
v16      v4         -.2972
v16      v5          .1961
v16      v6          .1601
v16      v7         -.1523
v16      v8          .0000
v16      v9          .0000
v16      v10         .0000
v16      v11         .0000
v16      v12         .1307
v16      v13         .0256
v16      v14         .0256
v16      v15        1.0000
v16      v16        1.0000
v16      v17         .0456
v16      v18         .0367
v16      v19        -.0456
v16      v20         .0863
v17      v1         -.0949
v17      v2         -.1240
v17      v3          .1093
v17      v4          .0739
v17      v5          .0387
v17      v6         -.0949
v17      v7         -.1093
v17      v8          .0000
v17      v9          .0000
v17      v10         .0000
v17      v11         .0000
v17      v12        -.0387
v17      v13        -.0456
v17      v14        -.0456
v17      v15         .0456
v17      v16         .0456
v17      v17        1.0000
v17      v18         .8057
v17      v19        -.6396
v17      v20         .3012
v18      v1         -.2294
v18      v2         -.2536
v18      v3          .0115
v18      v4          .1511
v18      v5         -.0468
v18      v6         -.2294
v18      v7         -.0115
v18      v8          .0000
v18      v9          .0000
v18      v10         .0000
v18      v11         .0000
v18      v12         .0468
v18      v13        -.0367
v18      v14        -.0367
v18      v15         .0367
v18      v16         .0367
v18      v17         .8057
v18      v18        1.0000
v18      v19        -.8057
v18      v20         .4258
v19      v1          .0949
v19      v2          .1240
v19      v3          .0808
v19      v4         -.0739
v19      v5          .1550
v19      v6          .0949
v19      v7         -.0808
v19      v8          .0000
v19      v9          .0000
v19      v10         .0000
v19      v11         .0000
v19      v12        -.1550
v19      v13         .0456
v19      v14         .0456
v19      v15        -.0456
v19      v16        -.0456
v19      v17        -.6396
v19      v18        -.8057
v19      v19        1.0000
v19      v20        -.3012
v20      v1         -.0599
v20      v2         -.1143
v20      v3          .2068
v20      v4         -.1470
v20      v5         -.0489
v20      v6         -.0599
v20      v7         -.2068
v20      v8          .0000
v20      v9          .0000
v20      v10         .0000
v20      v11         .0000
v20      v12        -.0733
v20      v13        -.0863
v20      v14        -.0863
v20      v15         .0863
v20      v16         .0863
v20      v17         .3012
v20      v18         .4258
v20      v19        -.3012
v20      v20        1.0000
end data.

*Version original (greater value = lighter).
GGRAPH /GRAPHDATASET NAME= 'graphdataset' VARIABLES= col row val /GRAPHSPEC SOURCE= INLINE.
BEGIN GPL
  PAGE: begin(scale(700px,520px))
  SOURCE: s=userSource(id("graphdataset"))
  DATA: row=col(source(s),name("row"),unit.category())
  DATA: col=col(source(s),name("col"),unit.category())
  DATA: val=col(source(s),name("val"))
  GUIDE: axis(dim(1),label(" "))
  GUIDE: axis(dim(2),label(" "))
  GUIDE: legend(aesthetic(aesthetic.color),label(" "))
  SCALE: cat(dim(1),sort.data())
  SCALE: cat(dim(2),sort.data(),reverse())
  ELEMENT: polygon(position(col*row)),color(color.grey),color.brightness.exterior(val),color.brightness.interior(val))
  PAGE: end()
END GPL.

*Version reverted (greater value = darker).
GGRAPH /GRAPHDATASET NAME= 'graphdataset' VARIABLES= col row val /GRAPHSPEC SOURCE= INLINE.
BEGIN GPL
  PAGE: begin(scale(700px,520px))
  SOURCE: s=userSource(id("graphdataset"))
  DATA: row=col(source(s),name("row"),unit.category())
  DATA: col=col(source(s),name("col"),unit.category())
  DATA: val=col(source(s),name("val"))
     TRANS: val2=eval(-val)
  GUIDE: axis(dim(1),label(" "))
  GUIDE: axis(dim(2),label(" "))
  GUIDE: legend(aesthetic(aesthetic.color),label(" "))
  SCALE: cat(dim(1),sort.data())
  SCALE: cat(dim(2),sort.data(),reverse())
  ELEMENT: polygon(position(col*row)),color(color.grey),color.brightness.exterior(val2),color.brightness.interior(val2))
  PAGE: end()
END GPL.

The problem left with the second one is that the LEGEND corresponds now to VAL2, but I want it to correspond to VAL (i.e. the darkmost must be 1.0, not -1.0)


26.11.2020 17:53, Jon Peck пишет:
You can just negate the brightness variable and leave it the brightness function for scaling
  TRANS: z = eval(-z)

I think that z can't be a categorical variable in the GPL code, however.




--
Jon K Peck
[hidden email]

===================== 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: reverse brightness into darkness

Kirill Orlov
This looks better but does not solve the problem. The values' scale at the legend goes according to val2, and I want it to be mirrored (be according to val).

26.11.2020 20:19, Jon Peck пишет:
How about this.

GGRAPH /GRAPHDATASET NAME= 'graphdataset' VARIABLES= col row val /GRAPHSPEC SOURCE= INLINE.
BEGIN GPL
  PAGE: begin(scale(700px,520px))
  SOURCE: s=userSource(id("graphdataset"))
  DATA: row=col(source(s),name("row"),unit.category())
  DATA: col=col(source(s),name("col"),unit.category())
  DATA: val=col(source(s),name("val"))
  TRANS: val2=eval(-val)
  GUIDE: axis(dim(1),label(" "))
  GUIDE: axis(dim(2),label(" "))
  GUIDE: legend(aesthetic(aesthetic.color.brightness.exterior),null())
  SCALE: cat(dim(1),sort.data())
  SCALE: cat(dim(2),sort.data(),reverse())
  ELEMENT: polygon(position(col*row)),color(color.grey),color.brightness.exterior(val2),color.brightness.interior(val2))
  PAGE: end()
END GPL

On Thu, Nov 26, 2020 at 8:43 AM Kirill Orlov <[hidden email]> wrote:
TRANS: neg_Z = eval(-Z)
does the job
but unfortunately the values displayed on the legend also negate. I have a legend.
Below is my example with a heatmap.


data list list  /row    col    val.
begin data
v1       v1         1.0000
v1       v2          .7035
v1       v3          .1502
v1       v4         -.2993
v1       v5          .2041
v1       v6         1.0000
v1       v7         -.1502
v1       v8          .0000
v1       v9          .0000
v1       v10         .0000
v1       v11         .0000
v1       v12        -.1021
v1       v13        -.1601
v1       v14        -.1601
v1       v15         .1601
v1       v16         .1601
v1       v17        -.0949
v1       v18        -.2294
v1       v19         .0949
v1       v20        -.0599
v2       v1          .7035
v2       v2         1.0000
v2       v3         -.0453
v2       v4         -.2347
v2       v5          .2872
v2       v6          .7035
v2       v7          .0453
v2       v8          .0000
v2       v9          .0000
v2       v10         .0000
v2       v11         .0000
v2       v12        -.0821
v2       v13         .1448
v2       v14         .1448
v2       v15         .1770
v2       v16         .1770
v2       v17        -.1240
v2       v18        -.2536
v2       v19         .1240
v2       v20        -.1143
v3       v1          .1502
v3       v2         -.0453
v3       v3         1.0000
v3       v4         -.1529
v3       v5          .0613
v3       v6          .1502
v3       v7        -1.0000
v3       v8          .0000
v3       v9          .0000
v3       v10         .0000
v3       v11         .0000
v3       v12        -.1635
v3       v13        -.1523
v3       v14        -.1523
v3       v15         .1523
v3       v16         .1523
v3       v17         .1093
v3       v18         .0115
v3       v19         .0808
v3       v20         .2068
v4       v1         -.2993
v4       v2         -.2347
v4       v3         -.1529
v4       v4         1.0000
v4       v5         -.1711
v4       v6         -.2993
v4       v7          .1529
v4       v8          .0000
v4       v9          .0000
v4       v10         .0000
v4       v11         .0000
v4       v12         .0489
v4       v13        -.0863
v4       v14        -.0863
v4       v15        -.2972
v4       v16        -.2972
v4       v17         .0739
v4       v18         .1511
v4       v19        -.0739
v4       v20        -.1470
v5       v1          .2041
v5       v2          .2872
v5       v3          .0613
v5       v4         -.1711
v5       v5         1.0000
v5       v6          .2041
v5       v7         -.0613
v5       v8          .0000
v5       v9          .0000
v5       v10         .0000
v5       v11         .0000
v5       v12         .0417
v5       v13         .1307
v5       v14         .1307
v5       v15         .1961
v5       v16         .1961
v5       v17         .0387
v5       v18        -.0468
v5       v19         .1550
v5       v20        -.0489
v6       v1         1.0000
v6       v2          .7035
v6       v3          .1502
v6       v4         -.2993
v6       v5          .2041
v6       v6         1.0000
v6       v7         -.1502
v6       v8          .0000
v6       v9          .0000
v6       v10         .0000
v6       v11         .0000
v6       v12        -.1021
v6       v13        -.1601
v6       v14        -.1601
v6       v15         .1601
v6       v16         .1601
v6       v17        -.0949
v6       v18        -.2294
v6       v19         .0949
v6       v20        -.0599
v7       v1         -.1502
v7       v2          .0453
v7       v3        -1.0000
v7       v4          .1529
v7       v5         -.0613
v7       v6         -.1502
v7       v7         1.0000
v7       v8          .0000
v7       v9          .0000
v7       v10         .0000
v7       v11         .0000
v7       v12         .1635
v7       v13         .1523
v7       v14         .1523
v7       v15        -.1523
v7       v16        -.1523
v7       v17        -.1093
v7       v18        -.0115
v7       v19        -.0808
v7       v20        -.2068
v8       v1          .0000
v8       v2          .0000
v8       v3          .0000
v8       v4          .0000
v8       v5          .0000
v8       v6          .0000
v8       v7          .0000
v8       v8         1.0000
v8       v9          .0000
v8       v10         .0000
v8       v11         .0000
v8       v12         .0000
v8       v13         .0000
v8       v14         .0000
v8       v15         .0000
v8       v16         .0000
v8       v17         .0000
v8       v18         .0000
v8       v19         .0000
v8       v20         .0000
v9       v1          .0000
v9       v2          .0000
v9       v3          .0000
v9       v4          .0000
v9       v5          .0000
v9       v6          .0000
v9       v7          .0000
v9       v8          .0000
v9       v9         1.0000
v9       v10         .0000
v9       v11         .0000
v9       v12         .0000
v9       v13         .0000
v9       v14         .0000
v9       v15         .0000
v9       v16         .0000
v9       v17         .0000
v9       v18         .0000
v9       v19         .0000
v9       v20         .0000
v10      v1          .0000
v10      v2          .0000
v10      v3          .0000
v10      v4          .0000
v10      v5          .0000
v10      v6          .0000
v10      v7          .0000
v10      v8          .0000
v10      v9          .0000
v10      v10        1.0000
v10      v11         .0000
v10      v12         .0000
v10      v13         .0000
v10      v14         .0000
v10      v15         .0000
v10      v16         .0000
v10      v17         .0000
v10      v18         .0000
v10      v19         .0000
v10      v20         .0000
v11      v1          .0000
v11      v2          .0000
v11      v3          .0000
v11      v4          .0000
v11      v5          .0000
v11      v6          .0000
v11      v7          .0000
v11      v8          .0000
v11      v9          .0000
v11      v10         .0000
v11      v11        1.0000
v11      v12         .0000
v11      v13         .0000
v11      v14         .0000
v11      v15         .0000
v11      v16         .0000
v11      v17         .0000
v11      v18         .0000
v11      v19         .0000
v11      v20         .0000
v12      v1         -.1021
v12      v2         -.0821
v12      v3         -.1635
v12      v4          .0489
v12      v5          .0417
v12      v6         -.1021
v12      v7          .1635
v12      v8          .0000
v12      v9          .0000
v12      v10         .0000
v12      v11         .0000
v12      v12        1.0000
v12      v13        -.1307
v12      v14        -.1307
v12      v15         .1307
v12      v16         .1307
v12      v17        -.0387
v12      v18         .0468
v12      v19        -.1550
v12      v20        -.0733
v13      v1         -.1601
v13      v2          .1448
v13      v3         -.1523
v13      v4         -.0863
v13      v5          .1307
v13      v6         -.1601
v13      v7          .1523
v13      v8          .0000
v13      v9          .0000
v13      v10         .0000
v13      v11         .0000
v13      v12        -.1307
v13      v13        1.0000
v13      v14        1.0000
v13      v15         .0256
v13      v16         .0256
v13      v17        -.0456
v13      v18        -.0367
v13      v19         .0456
v13      v20        -.0863
v14      v1         -.1601
v14      v2          .1448
v14      v3         -.1523
v14      v4         -.0863
v14      v5          .1307
v14      v6         -.1601
v14      v7          .1523
v14      v8          .0000
v14      v9          .0000
v14      v10         .0000
v14      v11         .0000
v14      v12        -.1307
v14      v13        1.0000
v14      v14        1.0000
v14      v15         .0256
v14      v16         .0256
v14      v17        -.0456
v14      v18        -.0367
v14      v19         .0456
v14      v20        -.0863
v15      v1          .1601
v15      v2          .1770
v15      v3          .1523
v15      v4         -.2972
v15      v5          .1961
v15      v6          .1601
v15      v7         -.1523
v15      v8          .0000
v15      v9          .0000
v15      v10         .0000
v15      v11         .0000
v15      v12         .1307
v15      v13         .0256
v15      v14         .0256
v15      v15        1.0000
v15      v16        1.0000
v15      v17         .0456
v15      v18         .0367
v15      v19        -.0456
v15      v20         .0863
v16      v1          .1601
v16      v2          .1770
v16      v3          .1523
v16      v4         -.2972
v16      v5          .1961
v16      v6          .1601
v16      v7         -.1523
v16      v8          .0000
v16      v9          .0000
v16      v10         .0000
v16      v11         .0000
v16      v12         .1307
v16      v13         .0256
v16      v14         .0256
v16      v15        1.0000
v16      v16        1.0000
v16      v17         .0456
v16      v18         .0367
v16      v19        -.0456
v16      v20         .0863
v17      v1         -.0949
v17      v2         -.1240
v17      v3          .1093
v17      v4          .0739
v17      v5          .0387
v17      v6         -.0949
v17      v7         -.1093
v17      v8          .0000
v17      v9          .0000
v17      v10         .0000
v17      v11         .0000
v17      v12        -.0387
v17      v13        -.0456
v17      v14        -.0456
v17      v15         .0456
v17      v16         .0456
v17      v17        1.0000
v17      v18         .8057
v17      v19        -.6396
v17      v20         .3012
v18      v1         -.2294
v18      v2         -.2536
v18      v3          .0115
v18      v4          .1511
v18      v5         -.0468
v18      v6         -.2294
v18      v7         -.0115
v18      v8          .0000
v18      v9          .0000
v18      v10         .0000
v18      v11         .0000
v18      v12         .0468
v18      v13        -.0367
v18      v14        -.0367
v18      v15         .0367
v18      v16         .0367
v18      v17         .8057
v18      v18        1.0000
v18      v19        -.8057
v18      v20         .4258
v19      v1          .0949
v19      v2          .1240
v19      v3          .0808
v19      v4         -.0739
v19      v5          .1550
v19      v6          .0949
v19      v7         -.0808
v19      v8          .0000
v19      v9          .0000
v19      v10         .0000
v19      v11         .0000
v19      v12        -.1550
v19      v13         .0456
v19      v14         .0456
v19      v15        -.0456
v19      v16        -.0456
v19      v17        -.6396
v19      v18        -.8057
v19      v19        1.0000
v19      v20        -.3012
v20      v1         -.0599
v20      v2         -.1143
v20      v3          .2068
v20      v4         -.1470
v20      v5         -.0489
v20      v6         -.0599
v20      v7         -.2068
v20      v8          .0000
v20      v9          .0000
v20      v10         .0000
v20      v11         .0000
v20      v12        -.0733
v20      v13        -.0863
v20      v14        -.0863
v20      v15         .0863
v20      v16         .0863
v20      v17         .3012
v20      v18         .4258
v20      v19        -.3012
v20      v20        1.0000
end data.

*Version original (greater value = lighter).
GGRAPH /GRAPHDATASET NAME= 'graphdataset' VARIABLES= col row val /GRAPHSPEC SOURCE= INLINE.
BEGIN GPL
  PAGE: begin(scale(700px,520px))
  SOURCE: s=userSource(id("graphdataset"))
  DATA: row=col(source(s),name("row"),unit.category())
  DATA: col=col(source(s),name("col"),unit.category())
  DATA: val=col(source(s),name("val"))
  GUIDE: axis(dim(1),label(" "))
  GUIDE: axis(dim(2),label(" "))
  GUIDE: legend(aesthetic(aesthetic.color),label(" "))
  SCALE: cat(dim(1),sort.data())
  SCALE: cat(dim(2),sort.data(),reverse())
  ELEMENT: polygon(position(col*row)),color(color.grey),color.brightness.exterior(val),color.brightness.interior(val))
  PAGE: end()
END GPL.

*Version reverted (greater value = darker).
GGRAPH /GRAPHDATASET NAME= 'graphdataset' VARIABLES= col row val /GRAPHSPEC SOURCE= INLINE.
BEGIN GPL
  PAGE: begin(scale(700px,520px))
  SOURCE: s=userSource(id("graphdataset"))
  DATA: row=col(source(s),name("row"),unit.category())
  DATA: col=col(source(s),name("col"),unit.category())
  DATA: val=col(source(s),name("val"))
     TRANS: val2=eval(-val)
  GUIDE: axis(dim(1),label(" "))
  GUIDE: axis(dim(2),label(" "))
  GUIDE: legend(aesthetic(aesthetic.color),label(" "))
  SCALE: cat(dim(1),sort.data())
  SCALE: cat(dim(2),sort.data(),reverse())
  ELEMENT: polygon(position(col*row)),color(color.grey),color.brightness.exterior(val2),color.brightness.interior(val2))
  PAGE: end()
END GPL.

The problem left with the second one is that the LEGEND corresponds now to VAL2, but I want it to correspond to VAL (i.e. the darkmost must be 1.0, not -1.0)


26.11.2020 17:53, Jon Peck пишет:
You can just negate the brightness variable and leave it the brightness function for scaling
  TRANS: z = eval(-z)

I think that z can't be a categorical variable in the GPL code, however.




--
Jon K Peck
[hidden email]

===================== 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: reverse brightness into darkness

Andy W
I believe

SCALE: linear(aesthetic(aesthetic.color.brightness), reverse())

does what you want Kirill. Via Progman's earlier example:

*************************************************************.
DATA LIST LIST/
X Y Z (2F8.0 F8.2).
BEGIN DATA
1 1 0.00
2 1 0.25
3 1 0.50
4 1 0.75
5 1 1.00
END DATA.
EXECUTE.

*No reverse, original scale.
GGRAPH
  /GRAPHDATASET
   NAME="graphdataset"
   VARIABLES=X Y Z
   MISSING=LISTWISE
   REPORTMISSING=NO
  /GRAPHSPEC
   SOURCE=INLINE
  /FITLINE
   TOTAL=NO.
BEGIN GPL
  SOURCE:  s=userSource(id("graphdataset"))
  DATA:    X=col(source(s), name("X"))
  DATA:    Y=col(source(s), name("Y"))
  DATA:    Z=col(source(s), name("Z"))
  GUIDE:   axis(dim(1), label("X"))
  GUIDE:   axis(dim(2), label("Y"))
  ELEMENT: point(position(X*Y)
                ,size(size."100")
                ,color.interior(color.blue)
                ,color.brightness(Z)
                )
END GPL.

*Reversing the scale.
GGRAPH
  /GRAPHDATASET
   NAME="graphdataset"
   VARIABLES=X Y Z
   MISSING=LISTWISE
   REPORTMISSING=NO
  /GRAPHSPEC
   SOURCE=INLINE
  /FITLINE
   TOTAL=NO.
BEGIN GPL
  SOURCE:  s=userSource(id("graphdataset"))
  DATA:    X=col(source(s), name("X"))
  DATA:    Y=col(source(s), name("Y"))
  DATA:    Z=col(source(s), name("Z"))
  TRANS:   revZ = eval(1 - Z)
  GUIDE:   axis(dim(1), label("X"))
  GUIDE:   axis(dim(2), label("Y"))
  SCALE: linear(aesthetic(aesthetic.color.brightness), reverse())
  ELEMENT: point(position(X*Y)
                ,size(size."100")
                ,color.interior(color.blue)
                ,color.brightness(Z)
                )
END GPL.
*************************************************************.



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
Sent from: http://spssx-discussion.1045642.n5.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
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: GPL: reverse brightness into darkness

Andy W
For your actual example Kirill you need to also do interior/exterior. But
this works generally for all 'aesthetic' scales, so works for colors, sizes,
etc.

GGRAPH /GRAPHDATASET NAME= 'graphdataset' VARIABLES= col row val /GRAPHSPEC
SOURCE= INLINE.
BEGIN GPL
  PAGE: begin(scale(700px,520px))
  SOURCE: s=userSource(id("graphdataset"))
  DATA: row=col(source(s),name("row"),unit.category())
  DATA: col=col(source(s),name("col"),unit.category())
  DATA: val=col(source(s),name("val"))
  GUIDE: axis(dim(1),label(" "))
  GUIDE: axis(dim(2),label(" "))
  GUIDE: legend(aesthetic(aesthetic.color),label(" "))
  SCALE: cat(dim(1),sort.data())
  SCALE: cat(dim(2),sort.data(),reverse())
  SCALE: linear(aesthetic(aesthetic.color.brightness.interior), reverse())
  SCALE: linear(aesthetic(aesthetic.color.brightness.exterior), reverse())
  ELEMENT:
polygon(position(col*row)),color(color.grey),color.brightness.exterior(val),color.brightness.interior(val))
  PAGE: end()
END GPL.



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
Sent from: http://spssx-discussion.1045642.n5.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
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: GPL: reverse brightness into darkness

Kirill Orlov
This is great Andy. It is what I wanted.
And it doesn't need TRANS statement, which is better.
Thank you.

27.11.2020 5:28, Andy W пишет:

> For your actual example Kirill you need to also do interior/exterior. But
> this works generally for all 'aesthetic' scales, so works for colors, sizes,
> etc.
>
> GGRAPH /GRAPHDATASET NAME= 'graphdataset' VARIABLES= col row val /GRAPHSPEC
> SOURCE= INLINE.
> BEGIN GPL
>    PAGE: begin(scale(700px,520px))
>    SOURCE: s=userSource(id("graphdataset"))
>    DATA: row=col(source(s),name("row"),unit.category())
>    DATA: col=col(source(s),name("col"),unit.category())
>    DATA: val=col(source(s),name("val"))
>    GUIDE: axis(dim(1),label(" "))
>    GUIDE: axis(dim(2),label(" "))
>    GUIDE: legend(aesthetic(aesthetic.color),label(" "))
>    SCALE: cat(dim(1),sort.data())
>    SCALE: cat(dim(2),sort.data(),reverse())
>    SCALE: linear(aesthetic(aesthetic.color.brightness.interior), reverse())
>    SCALE: linear(aesthetic(aesthetic.color.brightness.exterior), reverse())
>    ELEMENT:
> polygon(position(col*row)),color(color.grey),color.brightness.exterior(val),color.brightness.interior(val))
>    PAGE: end()
> END GPL.
>
>
>
> -----
> Andy W
> [hidden email]
> http://andrewpwheeler.wordpress.com/
> --
> Sent from: http://spssx-discussion.1045642.n5.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