|
5 | 5 |
|
6 | 6 | import matplotlib.cbook as cbook
|
7 | 7 |
|
8 |
| -import matplotlib.pyplot as plt |
9 | 8 | import matplotlib.axes as maxes
|
10 | 9 | #import matplotlib.colorbar as mcolorbar
|
11 | 10 | from . import colorbar as mcolorbar
|
@@ -814,94 +813,3 @@ def _update_locators(self):
|
814 | 813 |
|
815 | 814 | AxesGrid = ImageGrid
|
816 | 815 |
|
817 |
| -#if __name__ == "__main__": |
818 |
| -if 0: |
819 |
| - F = plt.figure(1, (7, 6)) |
820 |
| - F.clf() |
821 |
| - |
822 |
| - F.subplots_adjust(left=0.15, right=0.9) |
823 |
| - |
824 |
| - grid = Grid(F, 111, # similar to subplot(111) |
825 |
| - nrows_ncols=(2, 2), |
826 |
| - direction="row", |
827 |
| - axes_pad = 0.05, |
828 |
| - add_all=True, |
829 |
| - label_mode = "1", |
830 |
| - ) |
831 |
| - |
832 |
| -#if __name__ == "__main__": |
833 |
| -if 0: |
834 |
| - from .axes_divider import get_demo_image |
835 |
| - F = plt.figure(1, (9, 3.5)) |
836 |
| - F.clf() |
837 |
| - |
838 |
| - F.subplots_adjust(left=0.05, right=0.98) |
839 |
| - |
840 |
| - grid = ImageGrid(F, 131, # similar to subplot(111) |
841 |
| - nrows_ncols=(2, 2), |
842 |
| - direction="row", |
843 |
| - axes_pad = 0.05, |
844 |
| - add_all=True, |
845 |
| - label_mode = "1", |
846 |
| - ) |
847 |
| - |
848 |
| - Z, extent = get_demo_image() |
849 |
| - plt.ioff() |
850 |
| - for i in range(4): |
851 |
| - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") |
852 |
| - |
853 |
| - # This only affects axes in |
854 |
| - # first column and second row as share_all = False. |
855 |
| - grid.axes_llc.set_xticks([-2, 0, 2]) |
856 |
| - grid.axes_llc.set_yticks([-2, 0, 2]) |
857 |
| - plt.ion() |
858 |
| - |
859 |
| - grid = ImageGrid(F, 132, # similar to subplot(111) |
860 |
| - nrows_ncols=(2, 2), |
861 |
| - direction="row", |
862 |
| - axes_pad = 0.0, |
863 |
| - add_all=True, |
864 |
| - share_all=True, |
865 |
| - label_mode = "1", |
866 |
| - cbar_mode="single", |
867 |
| - ) |
868 |
| - |
869 |
| - Z, extent = get_demo_image() |
870 |
| - plt.ioff() |
871 |
| - for i in range(4): |
872 |
| - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") |
873 |
| - plt.colorbar(im, cax=grid.cbar_axes[0]) |
874 |
| - plt.setp(grid.cbar_axes[0].get_yticklabels(), visible=False) |
875 |
| - |
876 |
| - # This affects all axes as share_all = True. |
877 |
| - grid.axes_llc.set_xticks([-2, 0, 2]) |
878 |
| - grid.axes_llc.set_yticks([-2, 0, 2]) |
879 |
| - |
880 |
| - plt.ion() |
881 |
| - |
882 |
| - grid = ImageGrid(F, 133, # similar to subplot(122) |
883 |
| - nrows_ncols=(2, 2), |
884 |
| - direction="row", |
885 |
| - axes_pad = 0.1, |
886 |
| - add_all=True, |
887 |
| - label_mode = "1", |
888 |
| - share_all = True, |
889 |
| - cbar_location="top", |
890 |
| - cbar_mode="each", |
891 |
| - cbar_size="7%", |
892 |
| - cbar_pad="2%", |
893 |
| - ) |
894 |
| - plt.ioff() |
895 |
| - for i in range(4): |
896 |
| - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") |
897 |
| - plt.colorbar(im, cax=grid.cbar_axes[i], |
898 |
| - orientation="horizontal") |
899 |
| - grid.cbar_axes[i].xaxis.set_ticks_position("top") |
900 |
| - plt.setp(grid.cbar_axes[i].get_xticklabels(), visible=False) |
901 |
| - |
902 |
| - # This affects all axes as share_all = True. |
903 |
| - grid.axes_llc.set_xticks([-2, 0, 2]) |
904 |
| - grid.axes_llc.set_yticks([-2, 0, 2]) |
905 |
| - |
906 |
| - plt.ion() |
907 |
| - plt.draw() |
0 commit comments