def render(self, mode='human'):
    if (mode == 'rgb_array'):
        env_rgb_array = super().render(mode)
        (fig, ax) = plt.subplots(figsize=((self.image_shape[1] / 100), (self.image_shape[0] / 100)), constrained_layout=True, dpi=100)
        df = pd.DataFrame(np.array(self.q_values).T)
        sns.barplot(x=df.index, y=0, data=df, ax=ax)
        ax.set(xlabel='actions', ylabel='q-values')
        fig.canvas.draw()
        X = np.array(fig.canvas.renderer.buffer_rgba())
        Image.fromarray(X)
        rgb_image = np.array(Image.fromarray(X).convert('RGB'))
        plt.close(fig)
        q_value_rgb_array = rgb_image
        return np.append(env_rgb_array, q_value_rgb_array, axis=1)
    else:
        super().render(mode)
def render(self, mode='human'):
    if (mode == 'rgb_array'):
        env_rgb_array = super().render(mode)
        (fig, ax) = plt.subplots(figsize=((self.image_shape[1] / 100), (self.image_shape[0] / 100)), constrained_layout=True, dpi=100)
        df = pd.DataFrame(np.array(self.q_values).T)
        sns.barplot(x=df.index, y=0, data=df, ax=ax)
        ax.set(xlabel='actions', ylabel='q-values')
        fig.canvas.draw()
        X = np.array(fig.canvas.renderer.buffer_rgba())
        Image.fromarray(X)
        rgb_image = np.array(Image.fromarray(X).convert('RGB'))
        plt.close(fig)
        q_value_rgb_array = rgb_image
        return np.append(env_rgb_array, q_value_rgb_array, axis=1)
    else:
        super().render(mode)