Skip to content

Commit 1980c7a

Browse files
committedMay 5, 2014
TST: add tests for deprecation warnings from plotting functions
parallel_coordinates/andrews_curves - added deprecate_kwarg decorator for using frame argument instead of data - added tests to check that FutureWarning is raised properly
1 parent e8942ed commit 1980c7a

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed
 

‎doc/source/release.rst

+8
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ Deprecations
233233
instead of ``colors``. A ``FutureWarning`` is raised to alert that
234234
the old ``colors`` argument will not be supported in a future release
235235

236+
- The :func:`parallel_coordinates` and :func:`andrews_curves` functions now take
237+
positional argument ``frame`` instead of ``data``. A ``FutureWarning`` is
238+
raised if the old ``data`` argument is used by name.
239+
236240
Prior Version Deprecations/Changes
237241
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
238242

@@ -464,6 +468,10 @@ Bug Fixes
464468
- Bug in timeseries-with-frequency plot cursor display (:issue:`5453`)
465469
- Bug surfaced in groupby.plot when using a ``Float64Index`` (:issue:`7025`)
466470
- Stopped tests from failing if options data isn't able to be downloaded from Yahoo (:issue:`7034`)
471+
- Bug in ``parallel_coordinates`` and ``radviz`` where reordering of class column
472+
caused possible color/class mismatch
473+
- Bug in ``radviz`` and ``andrews_curves`` where multiple values of 'color'
474+
were being passed to plotting method
467475

468476
pandas 0.13.1
469477
-------------

‎doc/source/v0.14.0.txt

+8
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,14 @@ Plotting
382382

383383
Because of the default `align` value changes, coordinates of bar plots are now located on integer values (0.0, 1.0, 2.0 ...). This is intended to make bar plot be located on the same coodinates as line plot. However, bar plot may differs unexpectedly when you manually adjust the bar location or drawing area, such as using `set_xlim`, `set_ylim`, etc. In this cases, please modify your script to meet with new coordinates.
384384

385+
- The :func:`parallel_coordinates` function now takes argument ``color``
386+
instead of ``colors``. A ``FutureWarning`` is raised to alert that
387+
the old ``colors`` argument will not be supported in a future release
388+
389+
- The :func:`parallel_coordinates` and :func:`andrews_curves` functions now take
390+
positional argument ``frame`` instead of ``data``. A ``FutureWarning`` is
391+
raised if the old ``data`` argument is used by name.
392+
385393
.. _whatsnew_0140.prior_deprecations:
386394

387395
Prior Version Deprecations/Changes

‎pandas/tests/test_graphics.py

+9
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,9 @@ def test_andrews_curves(self):
12401240
ax = andrews_curves(df, 'Name', color=colors)
12411241
legend_colors = [l.get_color() for l in ax.legend().get_lines()]
12421242
self.assertEqual(colors, legend_colors)
1243+
1244+
with tm.assert_produces_warning(FutureWarning):
1245+
andrews_curves(data=df, class_column='Name')
12431246

12441247
@slow
12451248
def test_parallel_coordinates(self):
@@ -1269,6 +1272,12 @@ def test_parallel_coordinates(self):
12691272
ax = parallel_coordinates(df, 'Name', color=colors)
12701273
legend_colors = [l.get_color() for l in ax.legend().get_lines()]
12711274
self.assertEqual(colors, legend_colors)
1275+
1276+
with tm.assert_produces_warning(FutureWarning):
1277+
parallel_coordinates(df, 'Name', colors=colors)
1278+
1279+
with tm.assert_produces_warning(FutureWarning):
1280+
parallel_coordinates(data=df, class_column='Name')
12721281

12731282
@slow
12741283
def test_radviz(self):

‎pandas/tools/plotting.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ def _get_marker_compat(marker):
354354
return 'o'
355355
return marker
356356

357-
358357
def radviz(frame, class_column, ax=None, color=None, colormap=None, **kwds):
359358
"""RadViz - a multivariate data visualization algorithm
360359
@@ -439,7 +438,7 @@ def normalize(series):
439438
ax.axis('equal')
440439
return ax
441440

442-
441+
@deprecate_kwarg(old_arg_name='data', new_arg_name='frame')
443442
def andrews_curves(frame, class_column, ax=None, samples=200, color=None,
444443
colormap=None, **kwds):
445444
"""
@@ -571,6 +570,7 @@ def bootstrap_plot(series, fig=None, size=50, samples=500, **kwds):
571570
return fig
572571

573572
@deprecate_kwarg(old_arg_name='colors', new_arg_name='color')
573+
@deprecate_kwarg(old_arg_name='data', new_arg_name='frame')
574574
def parallel_coordinates(frame, class_column, cols=None, ax=None, color=None,
575575
use_columns=False, xticks=None, colormap=None,
576576
**kwds):

0 commit comments

Comments
 (0)
Please sign in to comment.