from torch import randint
from torchmetrics.classification import MulticlassMatthewsCorrCoef
metric = MulticlassMatthewsCorrCoef(num_classes=3)
metric.update(randint(3, (20,)), randint(3, (20,)))
fig_, ax_ = metric.plot()
