Skip to content

Commit

Permalink
plot for paper for run Fepv0_15_lr0001_5000epochs_lp130_separated_pos…
Browse files Browse the repository at this point in the history
…e_errors_qinitnoisy added, openai#2
  • Loading branch information
mahdinobar committed May 10, 2024
1 parent 1022dcf commit 6b0d87f
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion spinup/backup_gym/gym/envs/classic_control/fep.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,30 @@ def render(self, output_dir_rendering, mode='human'):
plt.savefig(output_dir_rendering + "/position.pdf", format="pdf", bbox_inches='tight')
plt.show()

fig1, axs1 = plt.subplots(3, 1, sharex=False, sharey=False, figsize=(6, 8))
plt.rcParams['font.family'] = 'Serif'
axs1[0].plot(self.plot_data_buffer[:, 3] * 1000, self.plot_data_buffer[:, 4] * 1000, 'k--',
label='EE desired traj')
axs1[0].plot(self.plot_data_buffer[:, 0] * 1000, self.plot_data_buffer[:, 1] * 1000, 'r')
axs1[0].plot(plot_data_buffer_no_SAC[:, 0] * 1000, plot_data_buffer_no_SAC[:, 1] * 1000, 'b')
axs1[0].set_xlabel("x[mm]")
axs1[0].set_ylabel("y[mm]")
axs1[1].plot(self.plot_data_buffer[:, 3] * 1000, self.plot_data_buffer[:, 5] * 1000, 'k--',
label='EE desired traj')
axs1[1].plot(self.plot_data_buffer[:, 0] * 1000, self.plot_data_buffer[:, 2] * 1000, 'r')
axs1[1].plot(plot_data_buffer_no_SAC[:, 0] * 1000, plot_data_buffer_no_SAC[:, 2] * 1000, 'b')
axs1[1].set_xlabel("x[mm]")
axs1[1].set_ylabel("z[mm]")
axs1[2].plot(self.plot_data_buffer[:, 4] * 1000, self.plot_data_buffer[:, 5] * 1000, 'k--',
label='EE desired traj')
axs1[2].plot(self.plot_data_buffer[:, 1] * 1000, self.plot_data_buffer[:, 2] * 1000, 'r',label='with SAC')
axs1[2].plot(plot_data_buffer_no_SAC[:, 1] * 1000, plot_data_buffer_no_SAC[:, 2] * 1000, 'b',label='without SAC')
axs1[2].set_xlabel("y[mm]")
axs1[2].set_ylabel("z[mm]")
plt.legend()
plt.savefig(output_dir_rendering + "/position_both.pdf", format="pdf", bbox_inches='tight')
plt.show()

fig2, axs2 = plt.subplots(3, 1, sharex=False, sharey=False, figsize=(7, 14))
axs2[0].plot(self.plot_data_buffer[:, 9], self.plot_data_buffer[:, 10], 'r--', label='EE desired traj',
marker=".",
Expand Down Expand Up @@ -582,6 +606,7 @@ def render(self, output_dir_rendering, mode='human'):
plt.show()

fig3, axs3 = plt.subplots(4, 1, sharex=False, sharey=False, figsize=(6, 8))
plt.rcParams['font.family'] = 'Serif'
axs3[0].plot(abs(plot_data_buffer_no_SAC[:, 0] - plot_data_buffer_no_SAC[:, 3]) * 1000, 'b',
label='without SAC')
axs3[0].plot(abs(self.plot_data_buffer[:, 0] - self.plot_data_buffer[:, 3]) * 1000, 'r', label='with SAC')
Expand Down Expand Up @@ -611,7 +636,7 @@ def render(self, output_dir_rendering, mode='human'):
# axs3[3].set_ylim([0, 10])
# axs3[3].set_yscale('log')
plt.legend()
plt.savefig(output_dir_rendering + "/position_errors.pdf", format="pdf", bbox_inches='tight')
plt.savefig(output_dir_rendering + "/position_errors_both.pdf", format="pdf", bbox_inches='tight')
plt.show()

fig4, axs4 = plt.subplots(3, 2, sharex=False, sharey=False, figsize=(8, 6))
Expand Down

0 comments on commit 6b0d87f

Please sign in to comment.