Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: fixup deprecated API in docs #3999

Merged
merged 5 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/cheatsheet.tex
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ \subsection{Plot Annotations}
\texttt{velocity(\textit{factor=},\textit{scale=},\textit{scale\_units=}, \textit{normalize=})} \textemdash\ Uses field "x-velocity" to draw quivers\\
\texttt{magnetic\_field(\textit{factor=},\textit{scale=},\textit{scale\_units=}, \textit{normalize=})} \textemdash\ Uses field "Bx" to draw quivers\\
\texttt{quiver(\textit{field\_x},\textit{field\_y},\textit{factor=},\textit{scale=},\textit{scale\_units=}, \textit{normalize=})} \\
\texttt{contour(\textit{field=},\textit{ncont=},\textit{factor=},\textit{clim=},\textit{take\_log=}, \textit{additional parameters})} \textemdash Plots a number of contours \textit{ncont} to interpolate \textit{field} optionally using \textit{take\_log}, upper and lower \textit{c}ontour\textit{lim}its and \textit{factor} number of points in the interpolation.\\
\texttt{contour(\textit{field=},\textit{levels=},\textit{factor=},\textit{clim=},\textit{take\_log=}, \textit{additional parameters})} \textemdash Plots a number of contours \textit{ncont} to interpolate \textit{field} optionally using \textit{take\_log}, upper and lower \textit{c}ontour\textit{lim}its and \textit{factor} number of points in the interpolation.\\
\texttt{grids(\textit{alpha=}, \textit{draw\_ids=}, \textit{periodic=}, \textit{min\_level=}, \textit{max\_level=})} \textemdash Add grid boundaries. \\
\texttt{streamlines(\textit{field\_x},\textit{field\_y},\textit{factor=},\textit{density=})}\\
\texttt{clumps(\textit{clumplist})} \textemdash\ Generate \textit{clumplist} using the clump finder and plot. \\
Expand Down
2 changes: 1 addition & 1 deletion doc/source/analyzing/filtering.rst
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ distributed throughout the dataset.
)

# Mark the center with a big X
prj.annotate_marker(center, "x", plot_args={"s": 100})
prj.annotate_marker(center, "x", s=100)

prj.show()

Expand Down
6 changes: 2 additions & 4 deletions doc/source/cookbook/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
coord_system="data",
circle_args={"color": "green", "linewidth": 4, "linestyle": "dashed"},
)
p.annotate_arrow([0.87, 0.59, 0.2], coord_system="data", plot_args={"color": "red"})
p.annotate_arrow([0.87, 0.59, 0.2], coord_system="data", color="red")
p.annotate_text([10, 20], "Some halos", coord_system="plot")
p.annotate_marker(
[0.45, 0.1, 0.4], coord_system="data", plot_args={"color": "yellow", "s": 500}
)
p.annotate_marker([0.45, 0.1, 0.4], coord_system="data", color="yellow", s=500)
p.annotate_line([0.2, 0.4], [0.3, 0.9], coord_system="axis")
p.annotate_timestamp(redshift=True)
p.annotate_scale()
Expand Down
4 changes: 2 additions & 2 deletions doc/source/cookbook/simple_contour_in_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Overlay the slice plot with thick red contours of density.
sp.annotate_contour(
("gas", "density"),
ncont=3,
levels=3,
clim=(1e-2, 1e-1),
label=True,
plot_args={"colors": "red", "linewidths": 2},
Expand All @@ -18,7 +18,7 @@
# What about some nice temperature contours in blue?
sp.annotate_contour(
("gas", "temperature"),
ncont=3,
levels=3,
clim=(1e-8, 1e-6),
label=True,
plot_args={"colors": "blue", "linewidths": 2},
Expand Down
5 changes: 3 additions & 2 deletions doc/source/examining/loading_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3112,8 +3112,9 @@ Gridding Behavior

When you load a CfRadial dataset in polar coordinates (elevation, azimuth and
range), yt will first build a sample by mapping the data onto a cartesian grid
using the Python-ARM Radar Toolkit (`pyart<https://github.com/ARM-DOE/pyart>`_). Grid points are found by interpolation of all data points within a specified radius of influence. This data, now
in x, y, z coordiante domain is then saved as a new dataset and subsequent
using the Python-ARM Radar Toolkit (`pyart <https://github.com/ARM-DOE/pyart>`_).
Grid points are found by interpolation of all data points within a specified radius of influence.
This data, now in x, y, z coordiante domain is then saved as a new dataset and subsequent
loads of the original native CfRadial dataset will use the gridded file.
Mapping the data from spherical to Cartesian coordinates is useful for 3D volume
rendering the data using yt.
Expand Down
2 changes: 0 additions & 2 deletions doc/source/reference/api/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ Loading Data
.. autosummary::

~yt.loaders.load
~yt.loaders.simulation
~yt.loaders.load_uniform_grid
~yt.loaders.load_amr_grids
~yt.loaders.load_particles
Expand Down Expand Up @@ -535,7 +534,6 @@ Field Functions
~yt.data_objects.static_output.Dataset.add_field
~yt.data_objects.static_output.Dataset.add_deposited_particle_field
~yt.data_objects.static_output.Dataset.add_mesh_sampling_particle_field
~yt.data_objects.static_output.Dataset.add_smoothed_particle_field
~yt.data_objects.static_output.Dataset.add_gradient_fields
~yt.frontends.stream.data_structures.StreamParticlesDataset.add_sph_fields

Expand Down
52 changes: 25 additions & 27 deletions doc/source/visualizing/callbacks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ of the x-plane (i.e. with axes in the y and z directions):

# Plot marker and text in figure coords
# N.B. marker will not render outside of axis bounds
s.annotate_marker((0.1, 0.2), coord_system="figure", plot_args={"color": "black"})
s.annotate_marker((0.1, 0.2), coord_system="figure", color="black")
s.annotate_text(
(0.1, 0.2),
"figure: (0.1, 0.2)",
Expand Down Expand Up @@ -184,8 +184,7 @@ List Currently Applied Callbacks
Overplot Arrow
~~~~~~~~~~~~~~

.. function:: annotate_arrow(self, pos, length=0.03, coord_system='data', \
plot_args=None)
.. function:: annotate_arrow(self, pos, length=0.03, coord_system='data', **kwargs)

(This is a proxy for
:class:`~yt.visualization.plot_modifications.ArrowCallback`.)
Expand All @@ -200,15 +199,15 @@ Overplot Arrow

ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
slc = yt.SlicePlot(ds, "z", ("gas", "density"), width=(10, "kpc"), center="c")
slc.annotate_arrow((0.5, 0.5, 0.5), length=0.06, plot_args={"color": "blue"})
slc.annotate_arrow((0.5, 0.5, 0.5), length=0.06, color="blue")
slc.save()

.. _annotate-clumps:

Clump Finder Callback
~~~~~~~~~~~~~~~~~~~~~

.. function:: annotate_clumps(self, clumps, plot_args=None)
.. function:: annotate_clumps(self, clumps, **kwargs)

(This is a proxy for
:class:`~yt.visualization.plot_modifications.ClumpContourCallback`.)
Expand Down Expand Up @@ -273,8 +272,8 @@ Overplot Quivers
Axis-Aligned Data Sources
^^^^^^^^^^^^^^^^^^^^^^^^^

.. function:: annotate_quiver(self, field_x, field_y, field_c=None, factor=16, scale=None, \
scale_units=None, normalize=False, plot_args=None)
.. function:: annotate_quiver(self, field_x, field_y, field_c=None, *, factor=16, scale=None, \
scale_units=None, normalize=False, **kwargs)

(This is a proxy for
:class:`~yt.visualization.plot_modifications.QuiverCallback`.)
Expand Down Expand Up @@ -341,8 +340,8 @@ And now using a continuous colormap
Off-Axis Data Sources
^^^^^^^^^^^^^^^^^^^^^

.. function:: annotate_cquiver(self, field_x, field_y, factor=16, scale=None, \
scale_units=None, normalize=False, plot_args=None)
.. function:: annotate_cquiver(self, field_x, field_y, field_c=None, *, factor=16, scale=None, \
scale_units=None, normalize=False, **kwargs)

(This is a proxy for
:class:`~yt.visualization.plot_modifications.CuttingQuiverCallback`.)
Expand All @@ -366,7 +365,7 @@ Off-Axis Data Sources
("gas", "cutting_plane_velocity_x"),
("gas", "cutting_plane_velocity_y"),
factor=10,
plot_args={"color": "orange"},
color="orange",
)
s.zoom(1.5)
s.save()
Expand Down Expand Up @@ -431,7 +430,7 @@ Overplot Cell Edges
Overplot a Straight Line
~~~~~~~~~~~~~~~~~~~~~~~~

.. function:: annotate_line(self, p1, p2, coord_system='data', plot_args=None)
.. function:: annotate_line(self, p1, p2, *, coord_system='data', **kwargs)

(This is a proxy for
:class:`~yt.visualization.plot_modifications.LinePlotCallback`.)
Expand All @@ -454,9 +453,9 @@ Overplot a Straight Line
Overplot Magnetic Field Quivers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. function:: annotate_magnetic_field(self, factor=16, scale=None, \
.. function:: annotate_magnetic_field(self, factor=16, *, scale=None, \
scale_units=None, normalize=False, \
plot_args=None)
**kwargs)

(This is a proxy for
:class:`~yt.visualization.plot_modifications.MagFieldCallback`.)
Expand All @@ -482,16 +481,15 @@ Overplot Magnetic Field Quivers
},
)
p = yt.ProjectionPlot(ds, "z", ("gas", "density"), center="c", width=(300, "kpc"))
p.annotate_magnetic_field(plot_args={"headlength": 3})
p.annotate_magnetic_field(headlength=3)
p.save()

.. _annotate-marker:

Annotate a Point With a Marker
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. function:: annotate_marker(self, pos, marker='x', coord_system='data', \
plot_args=None)
.. function:: annotate_marker(self, pos, marker='x', *, coord_system='data', **kwargs)

(This is a proxy for
:class:`~yt.visualization.plot_modifications.MarkerAnnotateCallback`.)
Expand All @@ -504,7 +502,7 @@ Annotate a Point With a Marker

ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
s = yt.SlicePlot(ds, "z", ("gas", "density"), center="c", width=(10, "kpc"))
s.annotate_marker((-2, -2), coord_system="plot", plot_args={"color": "blue", "s": 500})
s.annotate_marker((-2, -2), coord_system="plot", color="blue", s=500)
s.save()

.. _annotate-particles:
Expand Down Expand Up @@ -575,9 +573,9 @@ Overplot a Circle on a Plot
Overplot Streamlines
~~~~~~~~~~~~~~~~~~~~

.. function:: annotate_streamlines(self, field_x, field_y, factor=16, \
.. function:: annotate_streamlines(self, field_x, field_y, *, factor=16, \
density=1, display_threshold=None, \
plot_args=None)
**kwargs)

(This is a proxy for
:class:`~yt.visualization.plot_modifications.StreamlineCallback`.)
Expand Down Expand Up @@ -678,8 +676,8 @@ Add a Title
Overplot Quivers for the Velocity Field
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. function:: annotate_velocity(self, factor=16, scale=None, scale_units=None, \
normalize=False, plot_args=None)
.. function:: annotate_velocity(self, factor=16, *, scale=None, scale_units=None, \
normalize=False, **kwargs)

(This is a proxy for
:class:`~yt.visualization.plot_modifications.VelocityCallback`.)
Expand All @@ -698,7 +696,7 @@ Overplot Quivers for the Velocity Field

ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
p = yt.SlicePlot(ds, "z", ("gas", "density"), center="m", width=(10, "kpc"))
p.annotate_velocity(plot_args={"headwidth": 4})
p.annotate_velocity(headwidth=4)
p.save()

.. _annotate-timestamp:
Expand Down Expand Up @@ -778,7 +776,7 @@ Add a Physical Scale Bar
Annotate Triangle Facets Callback
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. function:: annotate_triangle_facets(triangle_vertices, plot_args=None)
.. function:: annotate_triangle_facets(triangle_vertices, **kwargs)

(This is a proxy for
:class:`~yt.visualization.plot_modifications.TriangleFacetsCallback`.)
Expand Down Expand Up @@ -813,15 +811,15 @@ Annotate Triangle Facets Callback
points = coords[conn - 1]

# Annotate slice-triangle intersection contours to the plot
s.annotate_triangle_facets(points, plot_args={"colors": "black"})
s.annotate_triangle_facets(points, colors="black")
s.save()

.. _annotate-mesh-lines:

Annotate Mesh Lines Callback
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. function:: annotate_mesh_lines(plot_args=None)
.. function:: annotate_mesh_lines(**kwargs)

(This is a proxy for
:class:`~yt.visualization.plot_modifications.MeshLinesCallback`.)
Expand All @@ -836,15 +834,15 @@ Annotate Mesh Lines Callback

ds = yt.load("MOOSE_sample_data/out.e")
sl = yt.SlicePlot(ds, "z", ("connect1", "nodal_aux"))
sl.annotate_mesh_lines(plot_args={"color": "black"})
sl.annotate_mesh_lines(color="black")
sl.save()

.. _annotate-ray:

Overplot the Path of a Ray
~~~~~~~~~~~~~~~~~~~~~~~~~~

.. function:: annotate_ray(ray, plot_args=None)
.. function:: annotate_ray(ray, *, arrow=False, **kwargs)

(This is a proxy for
:class:`~yt.visualization.plot_modifications.RayCallback`.)
Expand Down
2 changes: 1 addition & 1 deletion doc/source/visualizing/plots.rst
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ We can also annotate the mesh lines, as follows:

ds = yt.load("MOOSE_sample_data/out.e-s010")
sl = yt.SlicePlot(ds, "z", ("connect1", "diffused"))
sl.annotate_mesh_lines(plot_args={"color": "black"})
sl.annotate_mesh_lines(color="black")
sl.zoom(0.75)
sl.save()

Expand Down
2 changes: 1 addition & 1 deletion yt/visualization/plot_modifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,7 @@ def __init__(
"You can now pass arbitrary keyword arguments instead of a dictionary.",
since="4.1.0",
)
plot_args = {**def_plot_args, **plot_args}
plot_args = {**def_plot_args, **plot_args, **kwargs}
else:
plot_args = def_plot_args
self.plot_args = plot_args
Expand Down