diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bb9c934 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# generally ignore image files (but updates to the examples/images directory should still be noticed) +*.pdf +*.png +!examples/images/*.png + +# Distribution / packaging +build/ +*.egg-info/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 12cab88..f3ff622 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.12) -project(DUNEPlotStyle VERSION 01.02 LANGUAGES CXX) +project(DUNEPlotStyle VERSION 01.03 LANGUAGES CXX) set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS OWNER_READ diff --git a/examples/matplotlib/plotting_helpers.py b/examples/matplotlib/plotting_helpers.py index 8d17ee5..b899b68 100644 --- a/examples/matplotlib/plotting_helpers.py +++ b/examples/matplotlib/plotting_helpers.py @@ -38,10 +38,10 @@ def CovEllipse(xdata, ydata, cov, q=None, nsig=None, facecolor='none', **kwargs) width, height = 2 * np.sqrt(val[:, None] * r2) angle = np.degrees(np.arctan2(*vec[::-1, 0])) - xmean = np.mean(xdata) - ymean = np.mean(ydata) + xmean = np.squeeze(np.mean(xdata)) + ymean = np.squeeze(np.mean(ydata)) - ellipse = Ellipse(xy=(xmean,ymean), width=width, height=height, angle=angle, + ellipse = Ellipse(xy=(xmean,ymean), width=np.squeeze(width), height=np.squeeze(height), angle=np.squeeze(angle), facecolor=facecolor, **kwargs) return ellipse diff --git a/requirements.txt b/requirements.txt index 242a48a..1bb130c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -matplotlib==3.6.3 -numpy==1.24.1 -scipy==1.10.0 +matplotlib>=3.6.3 +numpy>=1.24.1 +scipy>=1.10.0 diff --git a/setup.cfg b/setup.cfg index c40e729..c1e0b79 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = dune_plot_style -version = 1.02 +version = 1.03 author = DUNE Authorship and Publications Board (APB) author_email = dune-apb@fnal.gov description = Plot styling tools diff --git a/src/matplotlib/__init__.py b/src/matplotlib/__init__.py index e69de29..1f38367 100644 --- a/src/matplotlib/__init__.py +++ b/src/matplotlib/__init__.py @@ -0,0 +1,15 @@ +try: + # This conceit handles the arrangement that comes out + # when dune_plot_style is set up standalone by using `pip install -e`. + # You may notice that this file is very similar to the one in the python/ subdirectory; + # that's because when installed with a regular `pip install` (without the `-e`), + # this file is not installed anywhere, and is not needed. + # It's only needed because the `install -e` invocation, instead of doing an install, + # simply points back to the package, so the directory structure is not rearranged as it is in installation. + import os, os.path, pathlib + from . import stylelib as module + os.environ["MPLCONFIGDIR"] = os.path.join(str(pathlib.Path(module.__path__[0]).parent.absolute()), "stylelib") + (os.pathsep + os.environ["MPLCONFIGDIR"] if "MPLCONFIGDIR" in os.environ else "") +except: + pass + +from .python import * \ No newline at end of file