1
- from __future__ import absolute_import
1
+ sortfrom __future__ import absolute_import
2
2
3
3
from numbers import Number
4
4
@@ -194,7 +194,7 @@ def violinplot(vals, fillcolor='#1f77b4', rugplot=True):
194
194
195
195
196
196
def violin_no_colorscale (data , data_header , group_header , colors ,
197
- use_colorscale , group_stats , rugplot , forced_order ,
197
+ use_colorscale , group_stats , rugplot , sort ,
198
198
height , width , title ):
199
199
"""
200
200
Refer to FigureFactory.create_violin() for docstring.
@@ -208,7 +208,7 @@ def violin_no_colorscale(data, data_header, group_header, colors,
208
208
for name in data [group_header ]:
209
209
if name not in group_name :
210
210
group_name .append (name )
211
- if forced_order :
211
+ if sort :
212
212
group_name .sort ()
213
213
214
214
gb = data .groupby ([group_header ])
@@ -251,7 +251,7 @@ def violin_no_colorscale(data, data_header, group_header, colors,
251
251
252
252
253
253
def violin_colorscale (data , data_header , group_header , colors , use_colorscale ,
254
- group_stats , rugplot , forced_order , height , width ,
254
+ group_stats , rugplot , sort , height , width ,
255
255
title ):
256
256
"""
257
257
Refer to FigureFactory.create_violin() for docstring.
@@ -265,7 +265,7 @@ def violin_colorscale(data, data_header, group_header, colors, use_colorscale,
265
265
for name in data [group_header ]:
266
266
if name not in group_name :
267
267
group_name .append (name )
268
- if forced_order :
268
+ if sort :
269
269
group_name .sort ()
270
270
271
271
# make sure all group names are keys in group_stats
@@ -347,7 +347,7 @@ def violin_colorscale(data, data_header, group_header, colors, use_colorscale,
347
347
348
348
349
349
def violin_dict (data , data_header , group_header , colors , use_colorscale ,
350
- group_stats , rugplot , forced_order , height , width , title ):
350
+ group_stats , rugplot , sort , height , width , title ):
351
351
"""
352
352
Refer to FigureFactory.create_violin() for docstring.
353
353
@@ -361,7 +361,7 @@ def violin_dict(data, data_header, group_header, colors, use_colorscale,
361
361
if name not in group_name :
362
362
group_name .append (name )
363
363
364
- if forced_order :
364
+ if sort :
365
365
group_name .sort ()
366
366
367
367
# check if all group names appear in colors dict
@@ -409,7 +409,7 @@ def violin_dict(data, data_header, group_header, colors, use_colorscale,
409
409
410
410
def create_violin (data , data_header = None , group_header = None , colors = None ,
411
411
use_colorscale = False , group_stats = None , rugplot = True ,
412
- forced_order = False , height = 450 , width = 600 ,
412
+ sort = False , height = 450 , width = 600 ,
413
413
title = 'Violin and Rug Plot' ):
414
414
"""
415
415
Returns figure for a violin plot
@@ -440,7 +440,7 @@ def create_violin(data, data_header=None, group_header=None, colors=None,
440
440
number and will be used to color the violin plots if a colorscale
441
441
is being used.
442
442
:param (bool) rugplot: determines if a rugplot is draw on violin plot.
443
- :param (bool) forced_order : determines if violins are sorted
443
+ :param (bool) sort : determines if violins are sorted.
444
444
alphabetically (True) or by inputted order (False).
445
445
:param (float) height: the height of the violin plot.
446
446
:param (float) width: the width of the violin plot.
@@ -489,7 +489,7 @@ def create_violin(data, data_header=None, group_header=None, colors=None,
489
489
490
490
# create violin fig
491
491
fig = create_violin(df, data_header='Score', group_header='Group',
492
- forced_order =True, height=600, width=1000)
492
+ sort =True, height=600, width=1000)
493
493
494
494
# plot
495
495
py.iplot(fig, filename='Violin Plot with Coloring')
@@ -607,14 +607,14 @@ def create_violin(data, data_header=None, group_header=None, colors=None,
607
607
# validate colors dict choice below
608
608
fig = violin_dict (
609
609
data , data_header , group_header , valid_colors ,
610
- use_colorscale , group_stats , rugplot , forced_order ,
610
+ use_colorscale , group_stats , rugplot , sort ,
611
611
height , width , title
612
612
)
613
613
return fig
614
614
else :
615
615
fig = violin_no_colorscale (
616
616
data , data_header , group_header , valid_colors ,
617
- use_colorscale , group_stats , rugplot , forced_order ,
617
+ use_colorscale , group_stats , rugplot , sort ,
618
618
height , width , title
619
619
)
620
620
return fig
0 commit comments