Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def output_monitor(self):
- matplotlib.rcParams.update({'font.size': 36})
- sz = 500
- x = np.linspace(-1.2, 0.6, sz)
- y = np.linspace(-0.07, 0.07, sz)
- xx, yy = np.meshgrid(x, y)
- states = np.stack((xx.reshape(-1), yy.reshape(-1)), 1)
- action_values = self.get_action_values(states)
- vmin = np.min(action_values)
- vmax = np.max(action_values)
- fig, axes = plt.subplots(figsize=(34, 7), nrows=1, ncols=3, sharey=True)
- for t in range(self.num_actions):
- axes[t].xaxis.set_tick_params(width=2, length=8)
- axes[t].xaxis.set_ticks(np.array([-1.0, -0.5, 0.0, 0.5]))
- if t == 0:
- axes[t].yaxis.set_tick_params(width=2, length=8)
- axes[t].yaxis.set_ticks(np.array([-0.5, 0.0, 0.5]))
- if t == 0:
- axes[t].set_title("Go to the left".format(t), y=1.05)
- if t == 1:
- axes[t].set_title("Do nothing".format(t), y=1.05)
- if t == 2:
- axes[t].set_title("Go to the right".format(t), y=1.05)
- mp = axes[t].imshow(action_values[:, t].reshape(sz, sz),
- extent=(-1.2, 0.6, 0.7, -0.7),
- interpolation='nearest', vmin=vmin-0.1,
- vmax=vmax+0.1)
- axes[t].set_xlabel('position')
- axes[0].set_ylabel('velosity * 10')
- fig.subplots_adjust(right=0.8)
- cbar_ax = fig.add_axes([0.85, -0.01, 0.04, 1.0])
- cbar_ax.xaxis.set_tick_params(width=2, length=8)
- cbar_ax.yaxis.set_tick_params(width=2, length=8)
- fig.colorbar(mp, cax=cbar_ax)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement