|
11 | 11 | from matplotlib import rcParams |
12 | 12 | from matplotlib.colors import BoundaryNorm |
13 | 13 | from matplotlib.cm import get_cmap |
| 14 | +from matplotlib import cm |
14 | 15 | from matplotlib.colorbar import ColorbarBase |
15 | 16 |
|
16 | 17 |
|
@@ -253,6 +254,33 @@ def test_colorbarbase(): |
253 | 254 | ColorbarBase(ax, plt.cm.bone) |
254 | 255 |
|
255 | 256 |
|
| 257 | +@image_comparison( |
| 258 | + baseline_images=['colorbar_closed_patch'], |
| 259 | + remove_text=True) |
| 260 | +def test_colorbar_closed_patch(): |
| 261 | + fig = plt.figure(figsize=(8,6)) |
| 262 | + ax1 = fig.add_axes([0.05, 0.85, 0.9, 0.1]) |
| 263 | + ax2 = fig.add_axes([0.05, 0.65, 0.9, 0.1]) |
| 264 | + ax3 = fig.add_axes([0.05, 0.45, 0.9, 0.1]) |
| 265 | + ax4 = fig.add_axes([0.05, 0.25, 0.9, 0.1]) |
| 266 | + ax5 = fig.add_axes([0.05, 0.05, 0.9, 0.1]) |
| 267 | + |
| 268 | + cmap = cm.jet |
| 269 | + cmap.set_under('w') |
| 270 | + cmap.set_over('w') |
| 271 | + |
| 272 | + im = ax1.pcolormesh(np.linspace(0,10,16).reshape((4,4))) |
| 273 | + |
| 274 | + plt.colorbar(im,cax=ax2,cmap=cmap,orientation='horizontal', |
| 275 | + extend='both',extendfrac=0.5) |
| 276 | + plt.colorbar(im,cax=ax3,cmap=cmap,orientation='horizontal', |
| 277 | + extend='both',) |
| 278 | + plt.colorbar(im,cax=ax4,cmap=cmap,orientation='horizontal', |
| 279 | + extend='both',extendrect=True) |
| 280 | + plt.colorbar(im,cax=ax5,cmap=cmap,orientation='horizontal', |
| 281 | + extend='neither') |
| 282 | + |
| 283 | + |
256 | 284 | if __name__ == '__main__': |
257 | 285 | import nose |
258 | 286 | nose.runmodule(argv=['-s', '--with-doctest'], exit=False) |
0 commit comments