Skip to content

Commit

Permalink
Merge pull request #3175 from johnjasa/change_deriv_plot_colorbar
Browse files Browse the repository at this point in the history
Quick fix for colormap on partials plot
  • Loading branch information
swryan committed Apr 3, 2024
2 parents b68c8cc + 47ba152 commit 00cc704
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions openmdao/visualization/partial_deriv_plot.py
Expand Up @@ -87,7 +87,8 @@ def partial_deriv_plot(of, wrt, check_partials_data, title=None, jac_method='J_f
# backend issues when testing
import matplotlib.pyplot as plt
BINARY_CMP = plt.cm.gray
NON_BINARY_CMP = plt.cm.RdBu
NON_BINARY_CMP = plt.cm.viridis
NON_BINARY_DIFF_CMP = plt.cm.RdBu
fig, ax = plt.subplots(ncols=3, figsize=(12, 6))
if title is None:
title = str(key)
Expand Down Expand Up @@ -118,8 +119,9 @@ def partial_deriv_plot(of, wrt, check_partials_data, title=None, jac_method='J_f
if vmax - vmin < tol: # Do not want range to be too small
vmin = -1 * tol
vmax = tol
im_diff = ax[2].imshow(diff, interpolation='none', vmin=vmin, vmax=vmax, cmap=NON_BINARY_CMP,
aspect='auto')
color_limit = max(abs(vmin), abs(vmax))
im_diff = ax[2].imshow(diff, interpolation='none', vmin=-color_limit, vmax=color_limit,
cmap=NON_BINARY_DIFF_CMP, aspect='auto')
fig.colorbar(im_diff, orientation='horizontal', ax=ax[2], aspect=10)
ax[2].set_title('Difference')

Expand Down

0 comments on commit 00cc704

Please sign in to comment.