| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -900,8 +900,7 @@ def set_alpha(self, alpha): | |||
| 900 | 900 | ||
| 901 | 901 | def remove(self): | |
| 902 | 902 | """Remove this colorbar from the figure.""" | |
| 903 | - self.ax.inner_ax.remove() | ||
| 904 | - self.ax.outer_ax.remove() | ||
| 903 | + self.ax.remove() | ||
| 905 | 904 | ||
| 906 | 905 | def _ticker(self, locator, formatter): | |
| 907 | 906 | """ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -759,6 +759,24 @@ def test_axes_handles_same_functions(fig_ref, fig_test): | |||
| 759 | 759 | caxx.set_position([0.92, 0.1, 0.02, 0.7]) | |
| 760 | 760 | ||
| 761 | 761 | ||
| 762 | + @check_figures_equal(extensions=["png"]) | ||
| 763 | + def test_colorbar_reuse_axes(fig_ref, fig_test): | ||
| 764 | + ax = fig_ref.add_subplot() | ||
| 765 | + pc = ax.imshow(np.arange(100).reshape(10, 10)) | ||
| 766 | + cb = fig_ref.colorbar(pc) | ||
| 767 | + cb2 = fig_ref.colorbar(pc, extend='both') | ||
| 768 | + | ||
| 769 | + ax = fig_test.add_subplot() | ||
| 770 | + pc = ax.imshow(np.arange(100).reshape(10, 10)) | ||
| 771 | + cb = fig_test.colorbar(pc, extend='both') | ||
| 772 | + cb2 = fig_test.colorbar(pc) | ||
| 773 | + # Clear and re-use the same colorbar axes | ||
| 774 | + cb.ax.cla() | ||
| 775 | + cb2.ax.cla() | ||
| 776 | + cb = fig_test.colorbar(pc, cax=cb.ax) | ||
| 777 | + cb2 = fig_test.colorbar(pc, cax=cb2.ax, extend='both') | ||
| 778 | + | ||
| 779 | + | ||
| 762 | 780 | def test_inset_colorbar_layout(): | |
| 763 | 781 | fig, ax = plt.subplots(constrained_layout=True, figsize=(3, 6)) | |
| 764 | 782 | pc = ax.imshow(np.arange(100).reshape(10, 10)) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments