Skip to content

Commit 636335a

Browse files
merqurioTomAugspurger
authored andcommitted
DOC: Improved the docstring of pandas.plotting.radviz (#20169)
1 parent fbebc7f commit 636335a

File tree

1 file changed

+54
-13
lines changed

1 file changed

+54
-13
lines changed

pandas/plotting/_misc.py

+54-13
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,66 @@ def _get_marker_compat(marker):
147147

148148

149149
def radviz(frame, class_column, ax=None, color=None, colormap=None, **kwds):
150-
"""RadViz - a multivariate data visualization algorithm
150+
"""
151+
Plot a multidimensional dataset in 2D.
152+
153+
Each Series in the DataFrame is represented as a evenly distributed
154+
slice on a circle. Each data point is rendered in the circle according to
155+
the value on each Series. Highly correlated `Series` in the `DataFrame`
156+
are placed closer on the unit circle.
157+
158+
RadViz allow to project a N-dimensional data set into a 2D space where the
159+
influence of each dimension can be interpreted as a balance between the
160+
influence of all dimensions.
161+
162+
More info available at the `original article
163+
<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.135.889>`_
164+
describing RadViz.
151165
152166
Parameters
153167
----------
154-
frame: DataFrame
155-
class_column: str
156-
Column name containing class names
157-
ax: Matplotlib axis object, optional
158-
color: list or tuple, optional
159-
Colors to use for the different classes
160-
colormap : str or matplotlib colormap object, default None
161-
Colormap to select colors from. If string, load colormap with that name
162-
from matplotlib.
163-
kwds: keywords
164-
Options to pass to matplotlib scatter plotting method
168+
frame : `DataFrame`
169+
Pandas object holding the data.
170+
class_column : str
171+
Column name containing the name of the data point category.
172+
ax : :class:`matplotlib.axes.Axes`, optional
173+
A plot instance to which to add the information.
174+
color : list[str] or tuple[str], optional
175+
Assign a color to each category. Example: ['blue', 'green'].
176+
colormap : str or :class:`matplotlib.colors.Colormap`, default None
177+
Colormap to select colors from. If string, load colormap with that
178+
name from matplotlib.
179+
kwds : optional
180+
Options to pass to matplotlib scatter plotting method.
165181
166182
Returns
167183
-------
168-
ax: Matplotlib axis object
184+
axes : :class:`matplotlib.axes.Axes`
185+
186+
See Also
187+
--------
188+
pandas.plotting.andrews_curves : Plot clustering visualization
189+
190+
Examples
191+
--------
192+
.. plot::
193+
:context: close-figs
194+
195+
>>> df = pd.DataFrame({
196+
... 'SepalLength': [6.5, 7.7, 5.1, 5.8, 7.6, 5.0, 5.4, 4.6,
197+
... 6.7, 4.6],
198+
... 'SepalWidth': [3.0, 3.8, 3.8, 2.7, 3.0, 2.3, 3.0, 3.2,
199+
... 3.3, 3.6],
200+
... 'PetalLength': [5.5, 6.7, 1.9, 5.1, 6.6, 3.3, 4.5, 1.4,
201+
... 5.7, 1.0],
202+
... 'PetalWidth': [1.8, 2.2, 0.4, 1.9, 2.1, 1.0, 1.5, 0.2,
203+
... 2.1, 0.2],
204+
... 'Category': ['virginica', 'virginica', 'setosa',
205+
... 'virginica', 'virginica', 'versicolor',
206+
... 'versicolor', 'setosa', 'virginica',
207+
... 'setosa']
208+
... })
209+
>>> rad_viz = pd.plotting.radviz(df, 'Category')
169210
"""
170211
import matplotlib.pyplot as plt
171212
import matplotlib.patches as patches

0 commit comments

Comments
 (0)