Skip to content
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

Simplify two colorbar tests and remove all others #2981

Merged
merged 3 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions pygmt/tests/baseline/test_colorbar.png.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
outs:
- md5: b274fb18c46c404e79dc293af9529567
size: 2652
hash: md5
path: test_colorbar.png
4 changes: 0 additions & 4 deletions pygmt/tests/baseline/test_colorbar_box.png.dvc

This file was deleted.

4 changes: 0 additions & 4 deletions pygmt/tests/baseline/test_colorbar_box_with_fill.png.dvc

This file was deleted.

4 changes: 0 additions & 4 deletions pygmt/tests/baseline/test_colorbar_scaled_z_values.png.dvc

This file was deleted.

4 changes: 0 additions & 4 deletions pygmt/tests/baseline/test_colorbar_shading_boolean.png.dvc

This file was deleted.

5 changes: 3 additions & 2 deletions pygmt/tests/baseline/test_colorbar_shading_list.png.dvc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
outs:
- md5: 823a04eb5398f1b101cb7ebc4af006f1
size: 56049
- md5: 52364ac84db033b53f7125ce12e95cce
size: 25000
path: test_colorbar_shading_list.png
hash: md5

This file was deleted.

49 changes: 4 additions & 45 deletions pygmt/tests/test_colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,12 @@

@pytest.mark.benchmark
@pytest.mark.mpl_image_compare
def test_colorbar_box():
def test_colorbar():
"""
Create colorbar with box around it.
Create a simple colorbar.
"""
fig = Figure()
fig.colorbar(cmap="rainbow", box=True, position="x0c/0c+w1c/0.5c")
return fig


@pytest.mark.mpl_image_compare
def test_colorbar_box_with_fill():
"""
Create colorbar with box that has a different colored fill.
"""
fig = Figure()
fig.colorbar(cmap="rainbow", box="+gorange", position="x0c/0c+w1c/0.5c")
return fig


@pytest.mark.mpl_image_compare
def test_colorbar_truncated_to_zlow_zhigh():
"""
Create colorbar truncated to z-low and z-high.
"""
fig = Figure()
fig.colorbar(cmap="rainbow", truncate=[0.15, 0.85], position="x0c/0c+w2c/0.5c")
return fig


@pytest.mark.mpl_image_compare
def test_colorbar_scaled_z_values():
"""
Create colorbar with z-values scaled to 0.1x of the original CPT.
"""
fig = Figure()
fig.colorbar(cmap="rainbow", scale=0.1, position="x0c/0c+w2c/0.5c")
return fig


@pytest.mark.mpl_image_compare
def test_colorbar_shading_boolean():
"""
Create colorbar and set shading with a Boolean value.
"""
fig = Figure()
fig.basemap(region=[0, 10, 0, 10], projection="X15c", frame="a")
fig.colorbar(cmap="geo", shading=True, frame=True)
fig.colorbar(cmap="rainbow", position="x0c/0c+w4c", frame=True)
return fig


Expand All @@ -63,6 +22,6 @@ def test_colorbar_shading_list():
Create colorbar and set shading by passing the high/low values as a list.
"""
fig = Figure()
fig.basemap(region=[0, 10, 0, 10], projection="X15c", frame="a")
fig.basemap(region=[0, 10, 0, 2], projection="X10c/2c", frame="a")
fig.colorbar(cmap="geo", shading=[-0.7, 0.2], frame=True)
return fig
Loading