def plot_value(ax: plt.Axes): rounded_value = np.round(learner.value, decimals=1) ax.set_axis_off() tb = Table(ax, bbox=[0, 0, 1, 1]) nrows, ncols = rounded_value.shape width, height = 1.0 / ncols, 1.0 / nrows for (i, j), val in np.ndenumerate(rounded_value): tb.add_cell(i, j, width, height, text=val, loc="center", facecolor="white") ax.add_table(tb)
def plot_value(self, ax: plt.Axes = None): if ax is None: _, ax = plt.subplots() rounded_value = np.round(self.value, decimals=2) ax.set_axis_off() tb = Table(ax, bbox=[0, 0, 1, 1]) nrows, ncols = rounded_value.shape width, height = 1.0 / ncols, 1.0 / nrows for (i, j), val in np.ndenumerate(rounded_value): tb.add_cell(i, j, width, height, text=val, loc="center", facecolor="white") for i in range(len(rounded_value)): tb.add_cell( i, -1, width, height, text=i + 1, loc="right", edgecolor="none", facecolor="none", ) tb.add_cell( -1, i, width, height / 2, text=i + 1, loc="center", edgecolor="none", facecolor="none", ) ax.add_table(tb)