@@ -412,7 +412,7 @@ def bootstrap_plot(series, fig=None, size=50, samples=500, **kwds):
412
412
413
413
414
414
def parallel_coordinates (data , class_column , cols = None , ax = None , colors = None ,
415
- use_columns = False , ** kwds ):
415
+ use_columns = False , xticks = None , ** kwds ):
416
416
"""Parallel coordinates plotting.
417
417
418
418
Parameters:
@@ -423,6 +423,7 @@ def parallel_coordinates(data, class_column, cols=None, ax=None, colors=None,
423
423
ax: matplotlib axis object, optional
424
424
colors: A list or tuple of colors to use for the different classes, optional
425
425
use_columns: If true, columns will be used as xticks, optional
426
+ xticks: A list of values to use for xticks, optional
426
427
kwds: A list of keywords for matplotlib plot method
427
428
428
429
Returns:
@@ -448,9 +449,17 @@ def random_color(column):
448
449
449
450
ncols = len (df .columns )
450
451
451
- # Determine values to use for xticks
452
- if use_columns and np .all (np .isreal (list (df .columns ))):
452
+ # determine values to use for xticks
453
+ if use_columns is True :
454
+ if not np .all (np .isreal (list (df .columns ))):
455
+ raise ValueError ('Columns must be numeric to be used as xticks' )
453
456
x = df .columns
457
+ elif xticks is not None :
458
+ if not np .all (np .isreal (xticks )):
459
+ raise ValueError ('xticks specified must be numeric' )
460
+ elif len (xticks ) != ncols :
461
+ raise ValueError ('Length of xticks must match number of columns' )
462
+ x = xticks
454
463
else :
455
464
x = range (ncols )
456
465
0 commit comments