Commit 534b26f1f0869766b51cd88aa4083b2a21ee7822
1 parent
3f66d021
Fix show_spectrum.py for all matplotlib versions
Showing
1 changed file
with
5 additions
and
1 deletions
examples/show_spectrum.py
| @@ -165,6 +165,9 @@ def get_spectrum_fits(fits): | @@ -165,6 +165,9 @@ def get_spectrum_fits(fits): | ||
| 165 | return spec | 165 | return spec |
| 166 | 166 | ||
| 167 | 167 | ||
| 168 | +# ========================= # | ||
| 169 | +# Plot delta log-likelihood # | ||
| 170 | +# ========================= # | ||
| 168 | def plot_dloglike(spec): | 171 | def plot_dloglike(spec): |
| 169 | """ | 172 | """ |
| 170 | Plot delta log-likelihood | 173 | Plot delta log-likelihood |
| @@ -198,7 +201,8 @@ def plot_dloglike(spec): | @@ -198,7 +201,8 @@ def plot_dloglike(spec): | ||
| 198 | dll_hist = [[row[i] for row in dll_hist] for i in range(steps)] | 201 | dll_hist = [[row[i] for row in dll_hist] for i in range(steps)] |
| 199 | 202 | ||
| 200 | # Plot the likelihood profiles | 203 | # Plot the likelihood profiles |
| 201 | - plt.pcolormesh(spec['engs_scan'], y_bounds, dll_hist, vmin=-10.0, vmax=0.0, | 204 | + plt.pcolormesh(np.array(spec['engs_scan']), y_bounds, |
| 205 | + np.array(dll_hist), vmin=-10.0, vmax=0.0, | ||
| 202 | cmap='Reds', alpha=0.9) | 206 | cmap='Reds', alpha=0.9) |
| 203 | cbar = plt.colorbar() | 207 | cbar = plt.colorbar() |
| 204 | cbar.set_label(r'$\Delta$ log-likelihood') | 208 | cbar.set_label(r'$\Delta$ log-likelihood') |