Ben Coman wrote:
I have two sets of data X & Y, which for all
combinations of (x@y) I
calculate a third value z, which ends up represented as a collection
of "points associated with a value eg (x(a)y)->z)."
I'd like to chart this as a heat map - very much like a Scatterplot
but each point '(x@y)' has its pixel color dependent on 'z'.
Any ideas how to go about this with EyeSee ?
cheers -ben
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
I worked this out. Just for the archives, here it is...
where chartData is a collection of associations of the form (x@y)->z ...
minCost := (chartData collect: [ :x | x value ]) min.
maxCost := (chartData collect: [ :x | x value ]) max.
costRange := maxCost - minCost.
colorBlock := [ :z| | colorIndex | colorIndex := (((z- 1 -
minCost) / (costRange )) * (colorChoices size) ) asInteger + 1 ] .
colorChoices := ((Color green darkShades: 4) reverse allButLast:
1) asOrderedCollection . "Greater differentiation near optimum"
colorChoices addAll: ((Color blue darkShades: 10) reverse
allButLast: 3 ) asOrderedCollection . "Remove blacks from the middle"
colorChoices addAll: ( (Color red darkShades: 10) reverse )
asOrderedCollection. "Fade to black"
colorDict := Dictionary keys: (1 to: colorChoices size)
asOrderedCollection values: colorChoices.
renderer compositeDiagram
add: (costBenefitDiagram := ESScatterPlot new) .
costBenefitDiagram
models: chartData ;
x: [ :data | data key x ] ;
y: [ :data | data key y ] ;
color: [ :data | colorBlock value: data value ] ; "data
value is z"
colorDict: colorDict ;
valueAxis ;
xAxisLabel: 'mm2' ;
yAxisLabel: 'kW' ;
rotatedLabels: true ;
addXDecorator: ESValueLabelDecorator new .
cheers -ben