Skip to content

Instantly share code, notes, and snippets.

@Hanrui-Wang
Last active July 17, 2019 18:10
Show Gist options
  • Select an option

  • Save Hanrui-Wang/f7e030048729c2d1bfeca2c1ad2fab9b to your computer and use it in GitHub Desktop.

Select an option

Save Hanrui-Wang/f7e030048729c2d1bfeca2c1ad2fab9b to your computer and use it in GitHub Desktop.
basic plot using matplotlib
import matplotlib.pyplot as plt
import matplotlib
plt.figure(i, figsize=(5.5, 5))
plt.grid(True, linewidth=0.2)
plt.plot(step, reward, linestyle=line_style[methods[i][ii]], linewidth=line_width[methods[i][ii]], color=colors[methods[i][ii]])
plt.ylim(top=y_top[i], bottom=y_bottom[i])
plt.xlim(left=0, right=10000)
plt.rcParams.update({'font.size': 12})
plt.legend([legend[methods[i][0]], legend[methods[i][1]], legend[methods[i][2]], legend[methods[i][3]], legend[methods[i][4]], legend[methods[i][5]], legend[methods[i][6]]])
plt.rcParams.update({'font.size': 15})
plt.xlabel('Number of Simulations')
plt.ylabel('Figure of Merit (Reward)')
plt.title(title[i])
plt.savefig((envs[i] + '.pdf'), format='pdf')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment