Skip to content

Commit

Permalink
toggle confusion matrix text
Browse files Browse the repository at this point in the history
  • Loading branch information
dberenbaum committed Oct 16, 2023
1 parent e04c5de commit 9836502
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/dvc_render/vega_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ def dict_replace_value(d: dict, name: str, value: Any) -> dict:
if v == name:
x[k] = value
continue
if name in v and isinstance(value, str):
v = v.replace(name, value)
x[k] = v
return x

Expand Down Expand Up @@ -205,6 +203,12 @@ class ConfusionTemplate(Template):
"data": {"values": Template.anchor("data")},
"title": Template.anchor("title"),
"facet": {"field": "rev", "type": "nominal"},
"params": [
{
"name": "toggleText",
"bind": {"input": "checkbox"},
},
],
"spec": {
"transform": [
{
Expand Down Expand Up @@ -294,6 +298,13 @@ class ConfusionTemplate(Template):
{
"mark": "text",
"encoding": {
"text": {
"condition": {
"param": "toggleText",
"field": "xy_count",
"type": "quantitative",
},
},
"color": {
"condition": {
"test": "datum.percent_of_max > 0.5",
Expand Down

0 comments on commit 9836502

Please sign in to comment.