diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 66316fe..b6fcaba 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ Changelog --------- +v4.2 (??? 2024) + * Made ``ncvue`` work with newer matplotlib versions, updating + colormaps and using matplotlib.pyplot.style 'seaborn-v0_8-dark'. + * Made ``ncvue`` work with newer Tcl/Tk versions (ttk.Style.theme_use). + v4.1.2 (Jun 2022) * Made ``ncvue`` a gui_script entry_point, so it can be called by `python -m ncvue`. diff --git a/src/ncvue/images/Greys.png b/src/ncvue/images/Greys.png index 67e401a..1a78235 100644 Binary files a/src/ncvue/images/Greys.png and b/src/ncvue/images/Greys.png differ diff --git a/src/ncvue/images/gist_gray.png b/src/ncvue/images/gist_gray.png index 93abbbb..4db94fa 100644 Binary files a/src/ncvue/images/gist_gray.png and b/src/ncvue/images/gist_gray.png differ diff --git a/src/ncvue/images/gray.png b/src/ncvue/images/gray.png index 93abbbb..4db94fa 100644 Binary files a/src/ncvue/images/gray.png and b/src/ncvue/images/gray.png differ diff --git a/src/ncvue/images/plot_png_colormaps.py b/src/ncvue/images/plot_png_colormaps.py index 1d6db49..2462447 100644 --- a/src/ncvue/images/plot_png_colormaps.py +++ b/src/ncvue/images/plot_png_colormaps.py @@ -14,7 +14,10 @@ # from matplotlib.backends.backend_pdf import PdfPages # matplotlib.rc('ps', usedistiller='xpdf') # ps2pdf from matplotlib import pyplot as plt -plt.style.use('seaborn-darkgrid') +try: + plt.style.use('seaborn-v0_8-darkgrid') +except OSError: + plt.style.use('seaborn-darkgrid') if __name__ == "__main__": diff --git a/src/ncvue/ncvcontour.py b/src/ncvue/ncvcontour.py index 7ec2510..a703512 100644 --- a/src/ncvue/ncvcontour.py +++ b/src/ncvue/ncvcontour.py @@ -47,8 +47,12 @@ import matplotlib # matplotlib.use('TkAgg') from matplotlib import pyplot as plt -# plt.style.use('seaborn-darkgrid') -plt.style.use('seaborn-dark') +try: + # plt.style.use('seaborn-v0_8-darkgrid') + plt.style.use('seaborn-v0_8-dark') +except OSError: + # plt.style.use('seaborn-darkgrid') + plt.style.use('seaborn-dark') # plt.style.use('fast') diff --git a/src/ncvue/ncvmap.py b/src/ncvue/ncvmap.py index 7f11da5..ea69ca0 100644 --- a/src/ncvue/ncvmap.py +++ b/src/ncvue/ncvmap.py @@ -51,8 +51,12 @@ import matplotlib as mpl # mpl.use('TkAgg') from matplotlib import pyplot as plt -# plt.style.use('seaborn-darkgrid') -plt.style.use('seaborn-dark') +try: + # plt.style.use('seaborn-v0_8-darkgrid') + plt.style.use('seaborn-v0_8-dark') +except OSError: + # plt.style.use('seaborn-darkgrid') + plt.style.use('seaborn-dark') # plt.style.use('fast') import cartopy.crs as ccrs diff --git a/src/ncvue/ncvscatter.py b/src/ncvue/ncvscatter.py index ab653a2..dc896f5 100644 --- a/src/ncvue/ncvscatter.py +++ b/src/ncvue/ncvscatter.py @@ -48,8 +48,12 @@ import matplotlib # matplotlib.use('TkAgg') from matplotlib import pyplot as plt -# plt.style.use('seaborn-darkgrid') -plt.style.use('seaborn-dark') +try: + # plt.style.use('seaborn-v0_8-darkgrid') + plt.style.use('seaborn-v0_8-dark') +except OSError: + # plt.style.use('seaborn-darkgrid') + plt.style.use('seaborn-dark') # plt.style.use('fast') diff --git a/src/ncvue/ncvue.py b/src/ncvue/ncvue.py index 31d5346..2de2cb6 100644 --- a/src/ncvue/ncvue.py +++ b/src/ncvue/ncvue.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Calling routine of ncvue. @@ -29,7 +29,6 @@ * Font size 13 on Windows for plots, Jun 2021, Matthias Cuntz """ -from __future__ import absolute_import, division, print_function import sys import tkinter as tk try: @@ -43,8 +42,8 @@ import netCDF4 as nc from .ncvmethods import analyse_netcdf from .ncvmain import ncvMain -import matplotlib as mpl -mpl.use('TkAgg') +# import matplotlib as mpl +# mpl.use('TkAgg') from matplotlib import pyplot as plt @@ -65,6 +64,7 @@ def ncvue(ncfile='', miss=np.nan): netcdf4.default_fillvals (default: np.nan). """ + # print(mpl.get_backend()) ios = platform.system() # Windows, Darwin, Linux if ios == 'Windows': # make Windows aware of high resolution displays @@ -88,7 +88,10 @@ def ncvue(ncfile='', miss=np.nan): if ios == 'Darwin': theme = 'aqua' style = ttk.Style() - style.theme_use(theme) + try: + style.theme_use(theme) + except: + pass elif ios == 'Windows': top.option_add("*Font", "Helvetica 10") plt.rc('font', size=13)