View difference between Paste ID: VzfXG7QT and iGdhCX8P
SHOW: | | - or go back to the newest paste.
1
    def output_monitor(self):
2
        matplotlib.rcParams.update({'font.size': 36})
3
        sz = 500 
4
        x = np.linspace(-1.2, 0.6, sz) 
5
        y = np.linspace(-0.07, 0.07, sz) 
6
        xx, yy = np.meshgrid(x, y)
7
        states = np.stack((xx.reshape(-1), yy.reshape(-1)), 1)
8
        action_values = self.get_action_values(states)
9
        vmin = np.min(action_values)
10
        vmax = np.max(action_values)
11
12
        fig, axes = plt.subplots(figsize=(34, 7), nrows=1, ncols=3, sharey=True)
13
        for t in range(self.num_actions):
14
            axes[t].xaxis.set_tick_params(width=2, length=8)
15
			axes[t].xaxis.set_ticks(np.array([-1.0, -0.5, 0.0, 0.5]))
16-
                axes[t].yaxis.set_tick_params(width=2, length=8)
16+
17
                axes[t].yaxis.set_tick_params(width=2, length=8)			
18
				axes[t].yaxis.set_ticks(np.array([-0.5, 0.0, 0.5]))
19
            if t == 0:
20
                axes[t].set_title("Go to the left".format(t), y=1.05)
21
            if t == 1:
22
                axes[t].set_title("Do nothing".format(t), y=1.05)
23
            if t == 2:
24
                axes[t].set_title("Go to the right".format(t), y=1.05)
25
26
            mp = axes[t].imshow(action_values[:, t].reshape(sz, sz),
27
                                extent=(-1.2, 0.6, 0.7, -0.7),
28
                                interpolation='nearest', vmin=vmin-0.1,
29
                                vmax=vmax+0.1)
30
            axes[t].set_xlabel('position')
31
            axes[0].set_ylabel('velosity * 10')
32
        fig.subplots_adjust(right=0.8)
33
        cbar_ax = fig.add_axes([0.85, -0.01, 0.04, 1.0])
34
        cbar_ax.xaxis.set_tick_params(width=2, length=8)
35
        cbar_ax.yaxis.set_tick_params(width=2, length=8)
36
        fig.colorbar(mp, cax=cbar_ax)
37
        plt.show()