Skip to content

Commit 1f28947

Browse files
committed
add print_grid param to create_violin
1 parent 1a1d762 commit 1f28947

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

plotly/tools.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ def _add_domain_is_3d(layout, s_label, x_domain, y_domain):
12111211
empty_str = ' (empty) ' # empty cell string
12121212

12131213
# Init grid_str with intro message
1214-
grid_str = "This is the format of your plot grid:\n"
1214+
grid_str = "This is the formats of your plot grid:\n"
12151215

12161216
# Init tmp list of lists of strings (sorta like 'grid_ref' but w/ strings)
12171217
_tmp = [['' for c in range(cols)] for r in range(rows)]
@@ -2708,7 +2708,7 @@ def _violinplot(vals, fillcolor='#1f77b4', rugplot=True):
27082708
@staticmethod
27092709
def _violin_no_colorscale(data, data_header, group_header, colors,
27102710
use_colorscale, group_stats,
2711-
height, width, title):
2711+
height, width, title, print_grid):
27122712
"""
27132713
Refer to FigureFactory.create_violin() for docstring.
27142714
@@ -2731,7 +2731,7 @@ def _violin_no_colorscale(data, data_header, group_header, colors,
27312731
fig = make_subplots(rows=1, cols=L,
27322732
shared_yaxes=True,
27332733
horizontal_spacing=0.025,
2734-
print_grid=True)
2734+
print_grid=print_grid)
27352735
color_index = 0
27362736
for k, gr in enumerate(group_name):
27372737
vals = np.asarray(gb.get_group(gr)[data_header], np.float)
@@ -2769,7 +2769,8 @@ def _violin_no_colorscale(data, data_header, group_header, colors,
27692769

27702770
@staticmethod
27712771
def _violin_colorscale(data, data_header, group_header, colors,
2772-
use_colorscale, group_stats, height, width, title):
2772+
use_colorscale, group_stats, height, width,
2773+
title, print_grid):
27732774
"""
27742775
Refer to FigureFactory.create_violin() for docstring.
27752776
@@ -2799,7 +2800,7 @@ def _violin_colorscale(data, data_header, group_header, colors,
27992800
fig = make_subplots(rows=1, cols=L,
28002801
shared_yaxes=True,
28012802
horizontal_spacing=0.025,
2802-
print_grid=True)
2803+
print_grid=print_grid)
28032804

28042805
# prepare low and high color for colorscale
28052806
lowcolor = FigureFactory._color_parser(
@@ -2870,7 +2871,7 @@ def _violin_colorscale(data, data_header, group_header, colors,
28702871

28712872
@staticmethod
28722873
def _violin_dict(data, data_header, group_header, colors, use_colorscale,
2873-
group_stats, height, width, title):
2874+
group_stats, height, width, title, print_grid):
28742875
"""
28752876
Refer to FigureFactory.create_violin() for docstring.
28762877
@@ -2900,7 +2901,7 @@ def _violin_dict(data, data_header, group_header, colors, use_colorscale,
29002901
fig = make_subplots(rows=1, cols=L,
29012902
shared_yaxes=True,
29022903
horizontal_spacing=0.025,
2903-
print_grid=True)
2904+
print_grid=print_grid)
29042905

29052906
for k, gr in enumerate(group_name):
29062907
vals = np.asarray(gb.get_group(gr)[data_header], np.float)
@@ -2936,7 +2937,8 @@ def _violin_dict(data, data_header, group_header, colors, use_colorscale,
29362937
@staticmethod
29372938
def create_violin(data, data_header=None, group_header=None,
29382939
colors=None, use_colorscale=False, group_stats=None,
2939-
height=450, width=600, title='Violin and Rug Plot'):
2940+
height=450, width=600, title='Violin and Rug Plot',
2941+
print_grid=True):
29402942
"""
29412943
Returns figure for a violin plot
29422944
@@ -2968,6 +2970,8 @@ def create_violin(data, data_header=None, group_header=None,
29682970
:param (float) height: the height of the violin plot
29692971
:param (float) width: the width of the violin plot
29702972
:param (str) title: the title of the violin plot
2973+
:param (str) print_grid: determines if make_subplots() returns a
2974+
printed string displaying the rows/columns dimensions
29712975
29722976
Example 1: Single Violin Plot
29732977
```
@@ -3134,13 +3138,15 @@ def create_violin(data, data_header=None, group_header=None,
31343138
# validate colors dict choice below
31353139
fig = FigureFactory._violin_dict(
31363140
data, data_header, group_header, valid_colors,
3137-
use_colorscale, group_stats, height, width, title
3141+
use_colorscale, group_stats, height, width, title,
3142+
print_grid
31383143
)
31393144
return fig
31403145
else:
31413146
fig = FigureFactory._violin_no_colorscale(
31423147
data, data_header, group_header, valid_colors,
3143-
use_colorscale, group_stats, height, width, title
3148+
use_colorscale, group_stats, height, width, title,
3149+
print_grid
31443150
)
31453151
return fig
31463152
else:
@@ -3160,7 +3166,8 @@ def create_violin(data, data_header=None, group_header=None,
31603166

31613167
fig = FigureFactory._violin_colorscale(
31623168
data, data_header, group_header, valid_colors,
3163-
use_colorscale, group_stats, height, width, title
3169+
use_colorscale, group_stats, height, width, title,
3170+
print_grid
31643171
)
31653172
return fig
31663173

0 commit comments

Comments
 (0)