Skip to content

Commit

Permalink
UX: rename user-facing functions to use snake case (SlicePlot -> slic…
Browse files Browse the repository at this point in the history
…e_plot and ProjectionPlot -> projection_plot). Keep old names as hard aliases.
  • Loading branch information
neutrinoceros committed Jul 22, 2021
1 parent 0985c5f commit 6fbdb5c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions yt/visualization/plot_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -2341,7 +2341,7 @@ def _sanitize_normal_vector(ds, normal) -> Union[str, np.ndarray]:
return normal


def SlicePlot(ds, normal, fields, *args, **kwargs):
def slice_plot(ds, normal, fields, *args, **kwargs):
r"""
A factory function for
:class:`yt.visualization.plot_window.AxisAlignedSlicePlot`
Expand Down Expand Up @@ -2473,9 +2473,9 @@ def SlicePlot(ds, normal, fields, *args, **kwargs):
>>> from yt import load
>>> ds = load("IsolatedGalaxy/galaxy0030/galaxy0030")
>>> slc = SlicePlot(ds, "x", ("gas", "density"), center=[0.2, 0.3, 0.4])
>>> slc = slice_plot(ds, "x", ("gas", "density"), center=[0.2, 0.3, 0.4])
>>> slc = SlicePlot(
>>> slc = slice_plot(
... ds, [0.4, 0.2, -0.1], ("gas", "pressure"), north_vector=[0.2, -0.3, 0.1]
... )
Expand Down Expand Up @@ -2504,7 +2504,7 @@ def SlicePlot(ds, normal, fields, *args, **kwargs):
return OffAxisSlicePlot(ds, normal, fields, *args, **kwargs)


def ProjectionPlot(ds, normal, fields, *args, **kwargs):
def projection_plot(ds, normal, fields, *args, **kwargs):
r"""
A factory function for
:class:`yt.visualization.plot_window.AxisAlignedProjectionPlot`
Expand All @@ -2519,7 +2519,7 @@ def ProjectionPlot(ds, normal, fields, *args, **kwargs):
Parameters
----------
... TODO: make this similar to SlicePlot
... TODO: make this similar to slice_plot
"""
normal = _sanitize_normal_vector(ds, normal)
if isinstance(normal, str):
Expand Down Expand Up @@ -2671,3 +2671,9 @@ def plot_2d(
aspect=aspect,
data_source=data_source,
)


# historical aliases
# see https://github.com/yt-project/yt/pull/3450
ProjectionPlot = AxisAlignedProjectionPlot
SlicePlot = slice_plot

0 comments on commit 6fbdb5c

Please sign in to comment.