Skip to content

Commit

Permalink
Differentiate between correlations and bubbles with warm/cool palette…
Browse files Browse the repository at this point in the history
…s, respectively.
  • Loading branch information
blakeNaccarato committed Aug 2, 2023
1 parent ab9ac25 commit df1db22
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 39 deletions.
1 change: 1 addition & 0 deletions .tools/requirements/requirements_both.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# * Changes below should persist in significant template updates.

git+https://github.com/blakeNaccarato/boilercine@main
git+https://github.com/blakeNaccarato/CMasher@fix-cm-deprecation

# * -------------------------------------------------------------------------------- * #
# * Changes below may be lost in significant template updates.
Expand Down
4 changes: 2 additions & 2 deletions data/docs.dvc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
outs:
- md5: 29f21802e3cd8d82a796750710d8fb82.dir
size: 3430183
- md5: 24468ff299e6b6f608ceb7e52618af0d.dir
size: 3246802
nfiles: 11
hash: md5
path: docs
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Computer vision routines suitable for nucleate pool boiling bubbl
readme = "README.md"
requires-python = ">=3.11"
classifiers = [ "License :: OSI Approved :: MIT License",]
dependencies = [ "dvc[gs]>=3.10.1", "imageio[pyav]>=2.31.1", "ipykernel>=6.25.0", "loguru>=0.7.0", "matplotlib>=3.7.2", "nbconvert>=7.7.3", "opencv-contrib-python>=4.8.0.74", "pandas[hdf5,performance]>=2.0.3", "pandera>=0.16.1", "pillow>=10.0.0", "ploomber-engine>=0.0.30", "pyarrow>=12.0.1", "pydantic>=1.10.12", "pyjanitor>=0.25.0", "pyqtgraph>=0.13.3", "pyside6>=6.5.2", "pytz>=2023.3", "pyyaml>=6.0.1", "ruamel.yaml>=0.17.32", "scikit-image>=0.21.0", "scipy>=1.11.1", "seaborn>=0.12.2", "sparklines>=0.4.2", "sympy>=1.12", "trackpy>=0.6.1", "xarray[accel,io,parallel]>=2023.7.0", "numba>=0.57.1", "numpy>=1.24.4",]
dependencies = [ "colorcet>=3.0.1", "dvc[gs]>=3.10.1", "imageio[pyav]>=2.31.1", "ipykernel>=6.25.0", "loguru>=0.7.0", "matplotlib>=3.7.2", "nbconvert>=7.7.3", "opencv-contrib-python>=4.8.0.74", "pandas[hdf5,performance]>=2.0.3", "pandera>=0.16.1", "pillow>=10.0.0", "ploomber-engine>=0.0.30", "pyarrow>=12.0.1", "pydantic>=1.10.12", "pyjanitor>=0.25.0", "pyqtgraph>=0.13.3", "pyside6>=6.5.2", "pytz>=2023.3", "pyyaml>=6.0.1", "ruamel.yaml>=0.17.32", "scikit-image>=0.21.0", "scipy>=1.11.1", "seaborn>=0.12.2", "sparklines>=0.4.2", "sympy>=1.12", "trackpy>=0.6.1", "xarray[accel,io,parallel]>=2023.7.0", "numba>=0.57.1", "numpy>=1.24.4",]
[[project.authors]]
name = "Blake Naccarato, Kwang Jin Kim"
email = "blake.naccarato@gmail.com"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# List project dependencies here. A workflow ports them to `pyproject.toml`
colorcet==3.0.1
dvc[gs]==3.10.1
imageio[pyav]==2.31.1
ipykernel==6.25.0
Expand Down
37 changes: 1 addition & 36 deletions src/boilercv/format.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
# type: ignore pyright 1.1.308, local/CI differences, below
from collections.abc import Mapping
from contextlib import contextmanager
from typing import Any, Literal
from typing import Any

import matplotlib as mpl
import numpy as np
import pandas as pd
from IPython.core.display import Markdown, Math # type: ignore
from IPython.display import display # type: ignore
from matplotlib import pyplot as plt
from matplotlib.axis import XAxis, YAxis
from matplotlib.ticker import MaxNLocator
from sympy import FiniteSet
from sympy.printing.latex import latex

Expand Down Expand Up @@ -43,37 +39,6 @@ def math_mod(expr, long_frac_ratio=3, **kwargs):
# * PLOTTING


def smart_set_lim(
ax: plt.Axes,
axis: Literal["x", "y", "z"],
limit: tuple[float, float],
prec: int = 0,
):
"""Set axis limits with smart precision and tick handling.
If axis limits exceed one, simply set the limits. Otherwise, set limits and
automatically choose the minimum necessary label format precision to represent the
limits. Limit the number of major ticks so as not to repeat tick labels given the
format precision.
Args:
ax: The axes object to operate on.
axis: The axis (e.g. "x" or "y") to operate on.
limit: The axes limits to apply.
prec: The maximum precision for the major ticks. Default is 0.
"""
getattr(ax, f"set_{axis}lim")(*limit)
if np.max(limit) > 1:
return
if prec == 0:
prec = int(np.min(np.floor(np.log10(np.array(limit)[np.array(limit) != 0]))))
axis_to_set: XAxis | YAxis = getattr(ax, f"{axis}axis")
axis_to_set.set_major_formatter(f"{{:#.{-prec}f}}".format)
axis_to_set.set_major_locator(
MaxNLocator(int(np.squeeze(np.diff(limit)) * 10**-prec))
)


@contextmanager
def manual_subplot_spacing():
"""Context manager that allows custom spacing of subplots."""
Expand Down

0 comments on commit df1db22

Please sign in to comment.