I was curious how to create a formatted Confusion Matrix: (https://developers.google.com/earth-engine/apidocs/ee-confusionmatrix)
I've completed my Supervised Classification, and I've created a Confusion Matrix with these results:
List (4 elements)
0: [1145,1,4,222]
1: [0,645,0,0]
2: [7,11,219,549]
3: [0,0,0,0]
How do I create a polished, formatted chart in GEE?
Like this beauty, but additionally with my classification types listed (I'm using City, Water, Forest, and Other)
(Image from: https://manisha-sirsat.blogspot.com/2019/04/confusion-matrix.html )
var classNames = ['City', 'Water', 'Forest', 'Other']
var confusionMatrix = [
[1145, 1, 4, 222],
[0, 645, 0, 0],
[7, 11, 219, 549],
[0, 0, 0, 0]
]
var panel = ui.Panel([...]) // How do I create a table with formatting?
print(panel)
https://code.earthengine.google.com/4fd7b66c0d01ef87ce62990e8fe350d8
Best Answer
You can use the
style
argument when creating yourui
widgets and use a subset of CSS to style them them. There are some missing features, like theborder-collapse
property, that makes it tricky to get pixel-perfect styling. Here's a starting point, which should point you in the right direction:https://code.earthengine.google.com/2cf1af6d384a6f5bb6982de3b4e8f6ec