Closed yantosca closed 1 year ago
We will also need to update the GCPy RTD documentation accordingly.
FYI, I was able to get a plot by setting
export MPLBACKEND="macosx"
in my Mac terminal window, and then using this test program from the matplotlib doc:
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
fruits = ['apple', 'blueberry', 'cherry', 'orange']
counts = [40, 100, 30, 55]
bar_labels = ['red', 'blue', '_red', 'orange']
bar_colors = ['tab:red', 'tab:blue', 'tab:red', 'tab:orange']
ax.bar(fruits, counts, label=bar_labels, color=bar_colors)
ax.set_ylabel('fruit supply')
ax.set_title('Fruit supply by kind and color')
ax.legend(title='Fruit color')
plt.show()
Also using:
export MPLBACKEND="qt5agg"
should work too.
I also suspect the version of the MacOSX operating system might matter.
Update: On MacOSX Sonoma 14.1.1, I was able to set
export MPLBACKEND=tkagg
in both the Mac terminal window and on a remote machine (Cannon). The sample program above was able to display the plot shown in the previous comment to the screen. I wonder if updating the OS solves the issue.
Update: On MacOSX Sonoma 14.1.1, I was able to set
export MPLBACKEND=tkagg
in both the Mac terminal window and on a remote machine (Cannon). The sample program above was able to display the plot shown in the previous comment to the screen. I wonder if updating the OS solves the issue.
I was finally able to get it to work using this solution. I think the key was executing the command in the Mac terminal window as well. Thanks! Good to merge now!
This is the companion PR for issue #269. In example scripts
gcpy/examples/plotting/plot_single_panel.py
andgcpy/examples/plotting/plot_comparisons.py
, we had set the X11 backend for Matplotib totkagg
(from the Tcl/Tk library). The X11 backend is necessary so that these example scripts can open a plot window on the screen.However, the
tkagg
backend is not compatible on MacOSX. Therefore, rather than hardcoding a value for the X11 backend, we will let the user pick the proper value by setting either: