Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions Book3_Ch16_Python_Codes/Bk3_Ch16_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def plot_surface(xx, yy, surface, title_txt):
colorbar = ax.contour(xx,yy, surface,20,
cmap = 'RdYlBu_r')

# fig.colorbar(colorbar, ax=ax)
fig.colorbar(colorbar, ax=ax)

ax.set_proj_type('ortho')

Expand All @@ -154,20 +154,19 @@ def plot_surface(xx, yy, surface, title_txt):

ax.view_init(azim=-135, elev=30)

ax.grid(False)
plt.show()
ax.grid(False)

ax = fig.add_subplot(1, 2, 2)
ax2 = fig.add_subplot(1, 2, 2)

colorbar = ax.contourf(xx,yy, surface, 20, cmap='RdYlBu_r')
colorbar = ax2.contourf(xx,yy, surface, 20, cmap='RdYlBu_r')

# fig.colorbar(colorbar, ax=ax)
fig.colorbar(colorbar, ax=ax2)

ax.set_xlim(xx.min(), xx.max())
ax.set_ylim(yy.min(), yy.max())
ax2.set_xlim(xx.min(), xx.max())
ax2.set_ylim(yy.min(), yy.max())

ax.set_xlabel('$x_1$')
ax.set_ylabel('$x_2$')
ax2.set_xlabel('$x_1$')
ax2.set_ylabel('$x_2$')
plt.gca().set_aspect('equal', adjustable='box')

plt.show()
Expand Down