Skip to content

Commit

Permalink
Hotfix: Comment out X11 backend commands in the plotting example code
Browse files Browse the repository at this point in the history
Newer versions of matplotlib require you to specify an X11 backend
library for matplotlib.pyplot.show() to work.  This requires us to
add an additional library to the gcpy_env environment. For now,
comment out the lines that invoke the X11 backend so as to allow
cloud benchmark simulations to work.  We will restore these once the
cloud container has been updated.

gcpy/examples/plotting/plot_comparisons.py
gcpy/examples/plotting/plot_single_panel.py
- Comment out the line to use the TkAgg backend.  This needs the "tk"
  package to be installed in the GCPy environment.

gcpy/docs/environment_files/environment.yml
- Add "tk" to the list of packages to install

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
  • Loading branch information
yantosca committed Oct 20, 2023
1 parent 8f75284 commit b021091
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/environment_files/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies:
- scipy # Scientific python package
- sparselt>=0.1.3 # Regridding earth system model data
- tabulate # Pretty-printing for column data
- tk # Tcl/Tk interface
- xarray # Read data from netCDF etc files
#
# NOTE: These packages need to be pegged at specific versions
Expand Down
2 changes: 1 addition & 1 deletion gcpy/examples/plotting/plot_comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import argparse
import xarray as xr
from matplotlib import use as mpl_use
mpl_use("TkAgg") # X11 backend for plt.show()
#mpl_use("TkAgg") # X11 backend for plt.show()
import matplotlib.pyplot as plt
from gcpy import plot
from gcpy.constants import skip_these_vars
Expand Down
2 changes: 1 addition & 1 deletion gcpy/examples/plotting/plot_single_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import argparse
import xarray as xr
from matplotlib import use as mpl_use
mpl_use("TkAgg") # X11 backend for plt.show()
#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
Expand Down

0 comments on commit b021091

Please sign in to comment.