Skip to content

Adjustments to contour.py so that levels are set accordingly to input vmin and vmax, if provided, so color bar works correctly. #2176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
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)