Skip to content

Commit

Permalink
vega: templates: make confusion matrix interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
pared committed May 10, 2022
1 parent 28593d2 commit 793fe3a
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/dvc_render/vega_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,30 @@ class ConfusionTemplate(Template):
}
},
},
{
"selection": {
"label": {
"type": "single",
"on": "mouseover",
"encodings": ["x", "y"],
"empty": "none",
"clear": "mouseout",
}
},
"mark": "rect",
"encoding": {
"opacity": {
"condition": {"selection": "label", "value": 1},
"value": 0,
}
},
},
{
"transform": [{"filter": {"selection": "label"}}],
"layer": [
{"mark": {"type": "rect", "color": "lightpink"}},
],
},
{
"mark": "text",
"encoding": {
Expand Down Expand Up @@ -257,6 +281,30 @@ class NormalizedConfusionTemplate(Template):
}
},
},
{
"selection": {
"label": {
"type": "single",
"on": "mouseover",
"encodings": ["x", "y"],
"empty": "none",
"clear": "mouseout",
}
},
"mark": "rect",
"encoding": {
"opacity": {
"condition": {"selection": "label", "value": 1},
"value": 0,
}
},
},
{
"transform": [{"filter": {"selection": "label"}}],
"layer": [
{"mark": {"type": "rect", "color": "lightpink"}},
],
},
{
"mark": "text",
"encoding": {
Expand Down

0 comments on commit 793fe3a

Please sign in to comment.