yieldplotlib.plots
==================

.. py:module:: yieldplotlib.plots

.. autoapi-nested-parse::

   Custom plot designs.



Submodules
----------

.. toctree::
   :maxdepth: 1

   /autoapi/yieldplotlib/plots/comparison_plots/index
   /autoapi/yieldplotlib/plots/generic_plot/index
   /autoapi/yieldplotlib/plots/hz_completeness/index
   /autoapi/yieldplotlib/plots/yield_hist/index
   /autoapi/yieldplotlib/plots/yip_plots/index


Functions
---------

.. autoapisummary::

   yieldplotlib.plots.compare
   yieldplotlib.plots.multi
   yieldplotlib.plots.panel
   yieldplotlib.plots.xy_grid
   yieldplotlib.plots.plot_hist
   yieldplotlib.plots.make_offax_psf_movie


Package Contents
----------------

.. py:function:: compare(ax, directories, x, y=None, plot_type='scatter', labels=None, colors=None, markers=None, linestyles=None, legend=True, **kwargs)

   Plot data from multiple directories on a single axes.

   Args:
       ax (matplotlib.axes.Axes):
           The axes to plot on.
       directories (list):
           List of DirectoryNode objects to plot.
       x (str):
           Key for x-axis data.
       y (str):
           Key for y-axis data.
       plot_type (str, optional):
           Type of plot to create. Options are 'scatter', 'plot', or 'hist'.
           Default is 'scatter'.
       labels (list, optional):
           List of labels for each directory node. If None, uses the directory node
           class names.
       colors (list, optional):
           List of colors for each directory. If None, uses default color cycle.
       markers (list, optional):
           List of markers for scatter plots. If None, uses DEFAULT_MARKERS.
       linestyles (list, optional):
           List of linestyles for line plots. If None, uses DEFAULT_LINESTYLES.
       legend (bool, optional):
           Whether to add a legend. Default is True.
       **kwargs:
           Additional keyword arguments passed to the plot method. Can include 'c' for
           color key data.

   Returns:
       matplotlib.axes.Axes:
           The axes with the plot.


.. py:function:: multi(directories, x, y=None, plot_type='scatter', figsize=None, suptitle=None, layout=None, sharex=True, sharey=True, titles=None, **kwargs)

   Create a multi-panel figure with one subplot per directory.

   Args:
       directories (list):
           List of DirectoryNode objects to plot.
       x (str):
           Key for x-axis data.
       y (str, optional):
           Key for y-axis data. Not required for histogram plots.
       plot_type (str, optional):
           Type of plot to create. Options are 'scatter', 'plot', or 'hist'.
           Default is 'scatter'.
       figsize (tuple, optional):
           Figure size (width, height) in inches.
       suptitle (str, optional):
           Super title for the entire figure.
       layout (tuple, optional):
           Layout for subplots as (rows, cols). If None, will be set automatically.
       sharex (bool, optional):
           Whether to share the x-axis across subplots. Default is True.
       sharey (bool, optional):
           Whether to share the y-axis across subplots. Default is True.
       titles (list, optional):
           List of titles for each subplot. If None, uses directory names.
       **kwargs:
           Additional keyword arguments passed to the plot method. Can include 'c' for
           color key data, 'markers' for scatter plots, 'linestyles' for line plots,
           or 'colors' for custom colors for each directory.

   Returns:
       tuple:
           (fig, axes) - The figure and array of axes created.


.. py:function:: panel(directories, *specs, figsize=None, suptitle=None, layout=None, sharex=True, sharey=True, titles=None, **kwargs)

   Create a multi-panel figure with customizable plotting specifications.

   Args:
       directories (list):
           List of DirectoryNode objects to plot.
       *specs:
           Variable number of plot specifications. Each spec is a dictionary with keys:
           - 'x': Key for x-axis data
           - 'y': Key for y-axis data (not required for histograms)
           - 'plot_type': Type of plot ('scatter', 'plot', 'hist')
           - 'c': Key for color data (optional)
           - Any other kwargs specific to that plot
       figsize (tuple, optional):
           Figure size (width, height) in inches.
       suptitle (str, optional):
           Super title for the entire figure.
       layout (tuple, optional):
           Layout for subplots as (rows, cols). If None, will be determined
           automatically.
       sharex (bool, optional):
           Whether to share the x-axis across subplots. Default is True.
       sharey (bool, optional):
           Whether to share the y-axis across subplots. Default is True.
       titles (list, optional):
           List of titles for each subplot. If None, uses descriptive titles.
       **kwargs:
           Additional keyword arguments passed to all plot methods.

   Returns:
       tuple:
           (fig, axes) - The figure and array of axes created.

   Example:
       fig, axes = ypl.panel(
           [exosims, ayo],
           {'x': 'star_dist', 'y': 'star_L', 'plot_type': 'scatter', 'c': 'star_L',
           'alpha': 0.7},
           {'x': 'wavelength', 'y': 'core_thruput', 'plot_type': 'plot', 'lw': 2},
           titles=['Star Properties', 'Throughput Curve']
       )


.. py:function:: xy_grid(directories, x_keys, y_keys, plot_type='scatter', figsize=None, suptitle=None, legend=True, sharex=False, sharey=False, titles=None, **kwargs)

   Create a grid of plots where each subplot corresponds to a set of (x, y) keys.

   Each subplot will plot all of the provided DirectoryNode objects using the
   specified plot type.

   Args:
       directories (list):
           List of DirectoryNode objects.
       x_keys (list):
           List of keys for x-axis data.
       y_keys (list):
           List of keys for y-axis data.
       plot_type (str, optional):
           Type of plot to create. Options are 'scatter', 'plot', or 'hist'.
            Default is 'scatter'.
       figsize (tuple, optional):
           Figure size in inches.
       suptitle (str, optional):
           Super title for the entire figure.
       legend (bool, optional):
           Whether to add a legend to each subplot. Default is True.
       sharex (bool, optional):
           Whether to share the x-axis across subplots. Default is True.
       sharey (bool, optional):
           Whether to share the y-axis across subplots. Default is True.
       titles (list, optional):
           List of titles for each subplot. Must have length equal to
           len(x_keys) * len(y_keys) if provided.
       **kwargs:
           Additional keyword arguments passed to the plotting method. Can
           include 'c' for color key data.

   Returns:
       tuple:
           (fig, axes) where fig is the matplotlib Figure and axes is a 2D
           array of Axes.


.. py:function:: plot_hist(temps, planet_bins, runs, run_labels, ax=None, ax_kwargs=None, use_cyberpunk=False)

   Plot a histogram of planet populations for different temperature bins.

   Args:
       temps (list):
           List of temperature bins to plot, e.g., ["hot", "warm", "cold"].
       planet_bins (list):
           List of planet types to plot, e.g., ["Earth", "Rocky", "Super Earth"].
       runs (list):
           List of EXOSIMSDirectories and AYODirectories to plot.
       run_labels (list):
           List of labels for each run.
       ax (matplotlib.axes.Axes, optional):
           Axes to plot on. If None, a new figure is created.
       ax_kwargs (dict, optional):
           Keyword arguments to pass to ax.set().
       use_cyberpunk (bool, optional):
           Whether to use the mplcyberpunk style. Default is False.

   Returns:
       matplotlib.figure.Figure, matplotlib.axes.Axes:
           Figure and axes objects for the plot.


.. py:function:: make_offax_psf_movie(yip, save_name, ax_kwargs=None, plot_kwargs=None)

   Generate a movie of the off-axis stellar PSF moving as a function of lambda/D.

   Args:
       yip (YIPDirectory):
           YIPDirectory to plot.
       save_name (str):
           File path to where the output movie will be saved.
       ax_kwargs (dict, optional):
           Keyword arguments to pass to ax.set().
       plot_kwargs (dict, optional):
           Keyword arguments to pass to plt.figure().

   Returns:
       None


