diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 637b695f..78a54030 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 =========================== diff --git a/orix/plot/stereographic_plot.py b/orix/plot/stereographic_plot.py index 7b344a8a..3ea28fd4 100644 --- a/orix/plot/stereographic_plot.py +++ b/orix/plot/stereographic_plot.py @@ -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: diff --git a/orix/tests/plot/test_stereographic_plot.py b/orix/tests/plot/test_stereographic_plot.py index fbb9d7b5..636965b7 100644 --- a/orix/tests/plot/test_stereographic_plot.py +++ b/orix/tests/plot/test_stereographic_plot.py @@ -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):