Skip to content

Commit

Permalink
Make polar stereograhic grid use Matplotlib's 'grid.alpha'
Browse files Browse the repository at this point in the history
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
  • Loading branch information
hakonanes committed Apr 22, 2023
1 parent a8068b5 commit e45da36
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Removed

Fixed
-----
- Transparency of polar stereographic grid lines can now be controlled by Matplotlib's
``grid.alpha``, just like the azimuth grid lines.

2023-03-14 - version 0.11.1
===========================
Expand Down
1 change: 1 addition & 0 deletions orix/plot/stereographic_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ def _polar_grid(self, resolution: Optional[float] = None):
label=label,
edgecolors=kwargs["ec"],
facecolors=kwargs["fc"],
alpha=kwargs["alpha"],
)
has_collection, index = self._has_collection(label, self.collections)
if has_collection:
Expand Down
7 changes: 6 additions & 1 deletion orix/tests/plot/test_stereographic_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,15 @@ def test_grids(self):
assert ax._azimuth_resolution == azimuth_res
assert ax._polar_resolution == polar_res

ax.stereographic_grid(azimuth_resolution=30, polar_resolution=45)
alpha = 0.5
with plt.rc_context({"grid.alpha": alpha}):
ax.stereographic_grid(azimuth_resolution=30, polar_resolution=45)
assert ax._azimuth_resolution == 30
assert ax._polar_resolution == 45

assert len(ax.collections) == 2
assert all([coll.get_alpha() for coll in ax.collections])

plt.close("all")

def test_set_labels(self):
Expand Down

0 comments on commit e45da36

Please sign in to comment.