Skip to content

Commit

Permalink
visualization/matplotlib-matrix.cc: check with is_inf + fix vmin/vmax
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Chrétien committed Jun 26, 2015
1 parent e915061 commit 4ffe992
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/visualization/matplotlib-matrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ namespace roboptim
ss << set_cmap
<< "cmap.set_bad('w',1.)\n"
<< "log_data = np.log10(abs(data))\n"
<< "masked_data = np.ma.array (log_data, mask=np.isnan(log_data))\n"
<< "crange = log_data.max()\n"
<< "masked_data = np.ma.array (log_data, mask=np.isinf(log_data))\n"
<< "crange = abs(masked_data).max()\n"
<< "im = plt.imshow(masked_data, interpolation='nearest', cmap=cmap, vmin=-crange, vmax=crange)\n"
<< "cbar = plt.colorbar(im)\n"
<< "cbar.draw_all()\n";
Expand Down Expand Up @@ -153,8 +153,8 @@ namespace roboptim
ss << set_cmap
<< "cmap.set_bad('w',1.)\n"
<< "log_data = np.log10(abs(data))\n"
<< "masked_data = np.ma.array (log_data, mask=np.isnan(log_data))\n"
<< "crange = log_data.max()\n"
<< "masked_data = np.ma.array (log_data, mask=np.isinf(log_data))\n"
<< "crange = abs(masked_data).max()\n"
<< "im = plt.imshow(masked_data, interpolation='nearest', cmap=cmap, vmin=-crange, vmax=crange)\n"
<< "cbar = plt.colorbar(im)\n"
<< "cbar.draw_all()\n";
Expand Down
8 changes: 4 additions & 4 deletions tests/visualization-matplotlib-matrix.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ cmap = matplotlib.colors.LinearSegmentedColormap.from_list(
(1, 0, 0)])
cmap.set_bad('w',1.)
log_data = np.log10(abs(data))
masked_data = np.ma.array (log_data, mask=np.isnan(log_data))
crange = log_data.max()
masked_data = np.ma.array (log_data, mask=np.isinf(log_data))
crange = abs(masked_data).max()
im = plt.imshow(masked_data, interpolation='nearest', cmap=cmap, vmin=-crange, vmax=crange)
cbar = plt.colorbar(im)
cbar.draw_all()
Expand Down Expand Up @@ -125,8 +125,8 @@ cmap = matplotlib.colors.LinearSegmentedColormap.from_list(
(1, 0, 0)])
cmap.set_bad('w',1.)
log_data = np.log10(abs(data))
masked_data = np.ma.array (log_data, mask=np.isnan(log_data))
crange = log_data.max()
masked_data = np.ma.array (log_data, mask=np.isinf(log_data))
crange = abs(masked_data).max()
im = plt.imshow(masked_data, interpolation='nearest', cmap=cmap, vmin=-crange, vmax=crange)
cbar = plt.colorbar(im)
cbar.draw_all()
Expand Down

0 comments on commit 4ffe992

Please sign in to comment.