Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added to test_contour.py for colorbar behavior
Two image check tests were added to test_contour.py to make a contourf plot using input argument vmax, one with vmax greater than the maximum of the data set z values and one with vmax less than the maximum of the data set z values.
  • Loading branch information
kthyng committed Jun 29, 2013
commit 3c01e5b10c65a3e2abc7fb2f3cf190df7e7d4ba7
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions lib/matplotlib/tests/test_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,30 @@ def test_given_colors_levels_and_extends():
plt.colorbar()


@image_comparison(baseline_images=['contour_vmax_over_colorbar_range'],
extensions=['png'])
def test_vmax_over_colorbar_range():
xvec = np.linspace(0, 10)
yvec = np.linspace(0, 20)
X, Y = np.meshgrid(xvec, yvec)
Z = X**2 + Y**2

plt.contourf(X, Y, Z, cmap='pink_r', vmax=700)
plt.colorbar()


@image_comparison(baseline_images=['contour_vmax_under_colorbar_range'],
extensions=['png'])
def test_vmax_under_colorbar_range():
xvec = np.linspace(0, 10)
yvec = np.linspace(0, 20)
X, Y = np.meshgrid(xvec, yvec)
Z = X**2 + Y**2

plt.contourf(X, Y, Z, cmap='pink_r', vmax=300)
plt.colorbar()


if __name__ == '__main__':
import nose
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)