Skip to content

Commit

Permalink
BUG: Improve default BarbPlot zorder
Browse files Browse the repository at this point in the history
Previously, the barbs would end up "lower" in the draw stack than
the lakes map overlay, as well as behind contour lines. This sets a
zorder of 2, which is enough to address both of these.
  • Loading branch information
dopplershift committed Oct 20, 2022
1 parent 6885351 commit 85d8b8c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/metpy/plots/declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ def _build(self):
self.handle = self.parent.ax.barbs(
x_like[wind_slice], y_like[wind_slice],
u.values[wind_slice], v.values[wind_slice],
color=self.color, pivot=self.pivot, length=self.barblength, **kwargs)
color=self.color, pivot=self.pivot, length=self.barblength, zorder=2, **kwargs)


@exporter.export
Expand Down
Binary file modified tests/plots/baseline/test_declarative_barb_earth_relative.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_barb_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions tests/plots/test_declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ def test_latlon():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.506)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.292)
@needs_cartopy
def test_declarative_barb_options():
"""Test making a contour plot."""
Expand All @@ -735,7 +735,7 @@ def test_declarative_barb_options():
panel = MapPanel()
panel.area = 'us'
panel.projection = 'data'
panel.layers = ['coastline', 'borders', 'usstates']
panel.layers = ['coastline', 'borders', 'usstates', 'land', 'ocean', 'lakes']
panel.plots = [barb]

pc = PanelContainer()
Expand Down Expand Up @@ -837,7 +837,7 @@ def test_declarative_arrow_changes():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.844)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.434)
@needs_cartopy
def test_declarative_barb_earth_relative():
"""Test making a contour plot."""
Expand Down

0 comments on commit 85d8b8c

Please sign in to comment.