Skip to content

Commit

Permalink
Hotfix: Load Tkagg backend before importing matplotlib.pyplot
Browse files Browse the repository at this point in the history
gcpy/examples/plotting/plot_comparisons.py
gcpy/examples/plotting/plot_single_panel.py
- Load the TkAgg X11 backend before importing matplotlib.pyplot,
  as this might be the cause of the error in issue #269

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
  • Loading branch information
yantosca committed Oct 19, 2023
1 parent 30a13f6 commit 8f75284
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions gcpy/examples/plotting/plot_comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
import argparse
import xarray as xr
from matplotlib import use as mpl_use
mpl_use("TkAgg") # X11 backend for plt.show()
import matplotlib.pyplot as plt
from gcpy import plot
from gcpy.constants import skip_these_vars
from gcpy.util import rename_and_flip_gchp_rst_vars

# X11 backend needed for plt.show()
mpl_use("tkagg")


def plot_comparisons(
ref,
Expand Down
4 changes: 1 addition & 3 deletions gcpy/examples/plotting/plot_single_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
import argparse
import xarray as xr
from matplotlib import use as mpl_use
mpl_use("TkAgg") # X11 backend for plt.show()
import matplotlib.pyplot as plt
from gcpy import plot
from gcpy.util import rename_and_flip_gchp_rst_vars

# X11 backend needed for plt.show()
mpl_use("tkagg")


def plot_single_panel(infile, varname, level):
"""
Expand Down

0 comments on commit 8f75284

Please sign in to comment.