Skip to content

Commit bcb6da0

Browse files
committed
Some pep:8ball: changes.
Ok the changes in default args are more than style changes… Just a heads up.
1 parent 490eeaa commit bcb6da0

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

plotly/figure_factory/_dendrogram.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ def create_dendrogram(X, orientation="bottom", labels=None,
3333
:param (str) orientation: 'top', 'right', 'bottom', or 'left'
3434
:param (list) labels: List of axis category labels(observation labels)
3535
:param (list) colorscale: Optional colorscale for dendrogram tree
36-
:param (function) distfun: Function to compute the pairwise distance from the observations
37-
:param (function) linkagefun: Function to compute the linkage matrix from the pairwise distances
36+
:param (function) distfun: Function to compute the pairwise distance from
37+
the observations
38+
:param (function) linkagefun: Function to compute the linkage matrix from
39+
the pairwise distances
3840
3941
clusters
4042
@@ -106,7 +108,8 @@ class _Dendrogram(object):
106108

107109
def __init__(self, X, orientation='bottom', labels=None, colorscale=None,
108110
width="100%", height="100%", xaxis='xaxis', yaxis='yaxis',
109-
distfun=None, linkagefun=lambda x: sch.linkage(x, 'complete')):
111+
distfun=None,
112+
linkagefun=lambda x: sch.linkage(x, 'complete')):
110113
self.orientation = orientation
111114
self.labels = labels
112115
self.xaxis = xaxis
@@ -130,7 +133,9 @@ def __init__(self, X, orientation='bottom', labels=None, colorscale=None,
130133
distfun = scs.distance.pdist
131134

132135
(dd_traces, xvals, yvals,
133-
ordered_labels, leaves) = self.get_dendrogram_traces(X, colorscale, distfun, linkagefun)
136+
ordered_labels, leaves) = self.get_dendrogram_traces(X, colorscale,
137+
distfun,
138+
linkagefun)
134139

135140
self.labels = ordered_labels
136141
self.leaves = leaves
@@ -245,8 +250,10 @@ def get_dendrogram_traces(self, X, colorscale, distfun, linkagefun):
245250
246251
:param (ndarray) X: Matrix of observations as array of arrays
247252
:param (list) colorscale: Color scale for dendrogram tree clusters
248-
:param (function) distfun: Function to compute the pairwise distance from the observations
249-
:param (function) linkagefun: Function to compute the linkage matrix from the pairwise distances
253+
:param (function) distfun: Function to compute the pairwise distance
254+
from the observations
255+
:param (function) linkagefun: Function to compute the linkage matrix
256+
from the pairwise distances
250257
:rtype (tuple): Contains all the traces in the following order:
251258
(a) trace_list: List of Plotly trace objects for dendrogram tree
252259
(b) icoord: All X points of the dendrogram tree as array of arrays

plotly/figure_factory/_distplot.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def validate_distplot(hist_data, curve_type):
5252

5353

5454
def create_distplot(hist_data, group_labels, bin_size=1., curve_type='kde',
55-
colors=[], rug_text=[], histnorm=DEFAULT_HISTNORM,
55+
colors=None, rug_text=None, histnorm=DEFAULT_HISTNORM,
5656
show_hist=True, show_curve=True, show_rug=True):
5757
"""
5858
BETA function that creates a distplot similar to seaborn.distplot
@@ -169,6 +169,11 @@ def create_distplot(hist_data, group_labels, bin_size=1., curve_type='kde',
169169
validate=False)
170170
```
171171
"""
172+
if colors is None:
173+
colors = []
174+
if rug_text is None:
175+
rug_text = []
176+
172177
validate_distplot(hist_data, curve_type)
173178
utils.validate_equal_length(hist_data, group_labels)
174179

plotly/figure_factory/_gantt.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ def gantt(chart, colors, title, bar_width, showgrid_x, showgrid_y, height,
7878
'opacity': 1,
7979
'line': {
8080
'width': 0,
81-
},
82-
'yref': 'y',
81+
}
8382
}
8483
# create the list of task names
8584
for index in range(len(tasks)):
@@ -206,8 +205,7 @@ def gantt_colorscale(chart, colors, title, index_col, show_colorbar, bar_width,
206205
'opacity': 1,
207206
'line': {
208207
'width': 0,
209-
},
210-
'yref': 'y',
208+
}
211209
}
212210

213211
# compute the color for task based on indexing column
@@ -455,8 +453,7 @@ def gantt_dict(chart, colors, title, index_col, show_colorbar, bar_width,
455453
'opacity': 1,
456454
'line': {
457455
'width': 0,
458-
},
459-
'yref': 'y',
456+
}
460457
}
461458

462459
index_vals = []

plotly/figure_factory/_trisurf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def create_trisurf(x, y, z, simplices, colormap=None, show_colorbar=True,
229229
zerolinecolor='rgb(255, 255, 255)',
230230
edges_color='rgb(50, 50, 50)',
231231
height=800, width=800,
232-
aspectratio=dict(x=1, y=1, z=1)):
232+
aspectratio=None):
233233
"""
234234
Returns figure for a triangulated surface plot
235235
@@ -452,6 +452,8 @@ def dist_origin(x, y, z):
452452
py.iplot(fig, filename="trisurf-plot-modern-art")
453453
```
454454
"""
455+
if aspectratio is None:
456+
aspectratio = {'x': 1, 'y': 1, 'z': 1}
455457

456458
# Validate colormap
457459
colors.validate_colors(colormap)

0 commit comments

Comments
 (0)