is provided, will automatically call `metric.compute` and plot that result. ax: An matplotlib axis object. If provided will add plot to that axis Returns: Figure and Axes object Raises: ModuleNotFoundError: If `matplotlib` is not installed .. plot:: :scale: 75 >>> import torch >>> from torchmetrics.retrieval import RetrievalHitRate >>> # Example plotting a single value >>> metric = RetrievalHitRate() >>> metric.update(torch.rand(10,), torch.randint(2, (10,)), indexes=torch.randint(2,(10,))) >>> fig_, ax_ = metric.plot() .. plot:: :scale: 75 >>> import torch >>> from torchmetrics.retrieval import RetrievalHitRate >>> # Example plotting multiple values >>> metric = RetrievalHitRate() >>> values = [] >>> for _ in range(10): ... values.append(metric(torch.rand(10,), torch.randint(2, (10,)), indexes=torch.randint(2,(10,)))) >>> fig, ax = metric.plot(values) )