From 3cfa0b7e66f4a9469f33809aa780f68f9890b604 Mon Sep 17 00:00:00 2001 From: Willy Guenthner Date: Sun, 21 Apr 2024 14:31:57 -0500 Subject: [PATCH] fixed issue with plots with more than 8 tT paths --- README.md | 2 +- pyproject.toml | 2 +- src/pythermo/tT_model.py | 12 +++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 579d20c..037e999 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ pip install pythermo ## Usage -It is recommended the you use this package in [Jupyter Notebooks](https://jupyter.org), which are included in the [Anaconda](https://www.anaconda.com/download) platform. Once you've downloaded or installed the package, and if you're just interested in running some forward models, the quickest way to get started is to modify the Jupyter Notebook file `template.ipynb` that is included in the `examples` folder. The notebook contains markdown and code that explains and demonstrates forward model date-eU comparisons for the apatite and zircon (U-Th)/He system. The forward modeling method is one particular approach and you can (and should!) call lower level methods to suite your needs. The `tT_path` and `crystal` classes contain several methods that you may want to call. A basic example of one way to use lower-level methods is included in `template.ipynb`. Please read the descriptions for each method in the source code for more details. +It is recommended that you use this package in [Jupyter Notebooks](https://jupyter.org), which are included in the [Anaconda](https://www.anaconda.com/download) platform. Once you've downloaded or installed the package, and if you're just interested in running some forward models, the quickest way to get started is to modify the Jupyter Notebook file `template.ipynb` that is included in the `examples` folder. The notebook contains markdown and code that explains and demonstrates forward model date-eU comparisons for the apatite and zircon (U-Th)/He system. The forward modeling method is one particular approach and you can (and should!) call lower level methods to suite your needs. The `tT_path` and `crystal` classes contain several methods that you may want to call. A basic example of one way to use lower-level methods is included in `template.ipynb`. Please read the descriptions for each method in the source code for more details. ## Citation diff --git a/pyproject.toml b/pyproject.toml index e03ba81..5a6e768 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=61.0","setuptools-git-versioning"] +requires = ["setuptools>=61.0", "wheel", "setuptools-git-versioning"] build-backend = "setuptools.build_meta" [tool.setuptools-git-versioning] diff --git a/src/pythermo/tT_model.py b/src/pythermo/tT_model.py index 285d89f..2bfbcbc 100644 --- a/src/pythermo/tT_model.py +++ b/src/pythermo/tT_model.py @@ -5,6 +5,8 @@ """ import matplotlib.pyplot as plt +import matplotlib.cm as mplcm +import matplotlib.colors as colors from cycler import cycler from .constants import np from .crystal import apatite, zircon @@ -271,11 +273,15 @@ def date_eU_plot(self, model_data, grain_num, comp_type): time_max = 0 temp_max = 0 - #set up color strings, if greater than 8 date-eU/tT sets, switch to viridis gradational color scheme - if np.size(model_data,1)/3 < 8: + #set up color strings, if greater than 8 date-eU/tT sets, switch to plasma gradational color scheme + if np.size(model_data,1)/3 <= 8: color_options = ['xkcd:black','xkcd:royal blue','xkcd:red','xkcd:sky','xkcd:lime','xkcd:dark purple','xkcd:rose','xkcd:grey'] else: - color_options = [] + num_of_colors = np.size(model_data,1)/3 + color_map = plt.get_cmap('plasma') + color_norm = colors.Normalize(vmin=0, vmax=num_of_colors-1) + scalar_map = mplcm.ScalarMappable(norm=color_norm, cmap=color_map) + color_options = [scalar_map.to_rgba(i) for i in range(num_of_colors)] #line option cycler for model comparisons line_options = cycler(line_style=['-','--',':','-.'])