# Path: metatlas/io/write_utils.py
# def make_dir_for(file_path):
# def check_existing_file(file_path, overwrite=False):
# def export_dataframe(dataframe, file_path, description, overwrite=False, **kwargs):
# def raise_on_diff(dataframe, file_path, description, **kwargs):
# def export_dataframe_die_on_diff(dataframe, file_path, description, overwrite=False, **kwargs):
# 
# Path: metatlas/plots/utils.py
# BACKGROUND_COLORS = ["white", "lightyellow", "whitesmoke", "lavenderblush"]
# def colors() -> Generator:
# def subplot_dimensions(num: int) -> Tuple[int, int]:
# def wrap_subplots(num: int, **kwargs) -> Tuple[matplotlib.figure.Figure, List[matplotlib.axes.Axes]]:
# def is_in_range(a: List[float], start: float, stop: float) -> List[bool]:
# def fill_under(
#     ax: matplotlib.axes.Axes,
#     x: List[float],
#     y: List[float],
#     between: Optional[Tuple[float, float]] = None,
#     **kwargs,
# ) -> None:
# def pdf_with_text(text: str, file_name: str, size: int = 24):


import datetime
import logging
import math
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import numpy.typing as npt
from abc import ABC
from typing import Optional, Sequence, Tuple
from matplotlib.backends.backend_pdf import PdfPages
from metatlas.io import write_utils
from metatlas.plots import utils
    def __exit__(self, exc_type, exc_value, exc_tb):
        self.close()

    def limit_axes(
        self,
        x_min: Optional[float],
        x_max: Optional[float],
        y_min: Optional[float],
        y_max: Optional[float],
    ) -> None:
        """Update all plots to have the desired axes limits"""
        if x_min is None and x_max is None and y_min is None and y_max is None:
            return
        sides = None
        if x_min is not None or x_max is not None:
            if y_min is None and y_max is None:
                sides = "both"
            elif y_min is None and y_max is not None:
                sides = "min"
            elif y_min is not None and y_max is None:
                sides = "max"
        for fig in self.figures:
            for ax in fig.axes:
                ax.set_xlim(left=x_min, right=x_max)
                ax.set_ylim(bottom=y_min, top=y_max)
                if sides is not None:
                    _autoscale(ax, axis="y", sides=sides)

    def save_pdf(self, file_name: str, title: str, overwrite: bool = False) -> None:
        """Create a PDF file containing one figure per page"""

# Path: metatlas/io/write_utils.py
# def make_dir_for(file_path):
# def check_existing_file(file_path, overwrite=False):
# def export_dataframe(dataframe, file_path, description, overwrite=False, **kwargs):
# def raise_on_diff(dataframe, file_path, description, **kwargs):
# def export_dataframe_die_on_diff(dataframe, file_path, description, overwrite=False, **kwargs):
# 
# Path: metatlas/plots/utils.py
# BACKGROUND_COLORS = ["white", "lightyellow", "whitesmoke", "lavenderblush"]
# def colors() -> Generator:
# def subplot_dimensions(num: int) -> Tuple[int, int]:
# def wrap_subplots(num: int, **kwargs) -> Tuple[matplotlib.figure.Figure, List[matplotlib.axes.Axes]]:
# def is_in_range(a: List[float], start: float, stop: float) -> List[bool]:
# def fill_under(
#     ax: matplotlib.axes.Axes,
#     x: List[float],
#     y: List[float],
#     between: Optional[Tuple[float, float]] = None,
#     **kwargs,
# ) -> None:
# def pdf_with_text(text: str, file_name: str, size: int = 24):


# Path: metatlas/plots/plot_set.py
import datetime
import logging
import math
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import numpy.typing as npt
from abc import ABC
from typing import Optional, Sequence, Tuple
from matplotlib.backends.backend_pdf import PdfPages
from metatlas.io import write_utils
from metatlas.plots import utils

    def __exit__(self, exc_type, exc_value, exc_tb):
        self.close()

    def limit_axes(
        self,
        x_min: Optional[float],
        x_max: Optional[float],
        y_min: Optional[float],
        y_max: Optional[float],
    ) -> None:
        """Update all plots to have the desired axes limits"""
        if x_min is None and x_max is None and y_min is None and y_max is None:
            return
        sides = None
        if x_min is not None or x_max is not None:
            if y_min is None and y_max is None:
                sides = "both"
            elif y_min is None and y_max is not None:
                sides = "min"
            elif y_min is not None and y_max is None:
                sides = "max"
        for fig in self.figures:
            for ax in fig.axes:
                ax.set_xlim(left=x_min, right=x_max)
                ax.set_ylim(bottom=y_min, top=y_max)
                if sides is not None:
                    _autoscale(ax, axis="y", sides=sides)

    def save_pdf(self, file_name: str, title: str, overwrite: bool = False) -> None:
        """Create a PDF file containing one figure per page"""

        write_utils.check_existing_file(file_name, overwrite)