Skip to content

Commit

Permalink
Merge pull request #4264 from neutrinoceros/hotfix_4263
Browse files Browse the repository at this point in the history
BUG: fix calling PlotContainer.set_font to set font color
  • Loading branch information
matthewturk authored Dec 28, 2022
2 parents 20a7957 + 9095b2a commit 39014cb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion yt/visualization/base_plot_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _set_font_properties(self, font_properties, font_color):
for label in self._get_labels():
label.set_fontproperties(font_properties)
if font_color is not None:
label.set_color(self.font_color)
label.set_color(font_color)

def _repr_png_(self):
from ._mpl_imports import FigureCanvasAgg
Expand Down
16 changes: 16 additions & 0 deletions yt/visualization/tests/test_plotwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,3 +912,19 @@ def test_invalid_swap_projection():
slc.set_mpl_projection("Robinson")
slc.swap_axes() # should raise mylog.warning and not toggle _swap_axes
assert slc._has_swapped_axes is False


def test_set_font():
# simply check that calling the set_font method doesn't raise an error
# https://github.com/yt-project/yt/issues/4263
ds = fake_amr_ds()
slc = SlicePlot(ds, "x", "Density")
slc.set_font(
{
"family": "sans-serif",
"style": "italic",
"weight": "bold",
"size": 24,
"color": "blue",
}
)

0 comments on commit 39014cb

Please sign in to comment.