Skip to content

Instantly share code, notes, and snippets.

@AdrianoPereira
Created June 5, 2021 22:58
Show Gist options
  • Save AdrianoPereira/f95bfc97d51bb7dbf6b8aae1958ba615 to your computer and use it in GitHub Desktop.
Save AdrianoPereira/f95bfc97d51bb7dbf6b8aae1958ba615 to your computer and use it in GitHub Desktop.
np.random.seed(42)
pixels = ['64-pixel', '96-pixel', '128-pixel', '160-pixel']
layers = ['1-layer', '2-layers', '3-layers', '4-layers', '5-layers']
rmse = np.random.uniform(1.5, 2.5, 20).reshape((4, 5))
rmse2 = np.random.uniform(0.5, .9, 20).reshape((4, 5))
dpi = 96
xmonitor = np.round(1366 * 80 / 100)/dpi
ymonitor = np.round(768 * 100 / 100)/dpi
fig = plt.figure(figsize=(xmonitor, ymonitor), dpi=dpi, facecolor='w')
ax1 = plt.subplot(2, 2, 1)
ax2 = plt.subplot(2, 2, 2)
ax3 = plt.subplot(2, 1, 2)
ax = [ax1, ax2, ax3]
for i in range(rmse.shape[1]):
ax[0].plot(pixels, rmse[:, i], ls='-', marker='o', label=layers[i])
for i in range(rmse.shape[1]):
ax[1].plot(pixels, rmse2[:, i], ls='-', marker='o', label=layers[i])
ax[2].plot([], ls='-', marker='o', label=layers[i])
ax[0].set_title('Calibration wind velocity prediction model', fontdict=dict(weight='bold'))
ax[0].grid(ls='--')
ax[0].set_ylabel('RMSE (m/s)')
ax[0].set_xlabel('Image size')
ax[1].set_title('Calibration wave height prediction model', fontdict=dict(weight='bold'))
ax[1].grid(ls='--')
ax[1].set_ylabel('RMSE (m)')
ax[1].set_xlabel('Image size')
ax[2].legend(loc='upper center', ncol=5)
ax[2].axis('off')
plt.savefig('plot.png', rasterized=True, dpi=dpi*5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment