Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af965d0

Browse files
committed
fixed tests
1 parent 5273f2d commit af965d0

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

plotly/figure_factory/_facet_grid.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,8 @@ def _facet_grid(df, x, y, facet_row, facet_col, num_of_rows,
488488
type=trace_type,
489489
marker=dict(
490490
color=marker_color,
491-
line=kwargs_marker['line']
491+
line=kwargs_marker['line'],
492+
#opacity=kwargs_marker['opacity'],
492493
),
493494
**kwargs_trace
494495
)
@@ -512,7 +513,8 @@ def _facet_grid(df, x, y, facet_row, facet_col, num_of_rows,
512513
type=trace_type,
513514
marker=dict(
514515
color=marker_color,
515-
line=kwargs_marker['line']
516+
line=kwargs_marker['line'],
517+
#opacity=kwargs_marker['opacity'],
516518
),
517519
**kwargs_trace
518520
)
@@ -562,7 +564,8 @@ def _facet_grid(df, x, y, facet_row, facet_col, num_of_rows,
562564
type=trace_type,
563565
marker=dict(
564566
color=marker_color,
565-
line=kwargs_marker['line']
567+
line=kwargs_marker['line'],
568+
#opacity=kwargs_marker['opacity'],
566569
),
567570
**kwargs_trace
568571
)
@@ -812,7 +815,7 @@ def create_facet_grid(df, x=None, y=None, facet_row=None, facet_col=None,
812815

813816
if 'opacity' not in kwargs_marker:
814817
if not ggplot2:
815-
kwargs_marker['opacity'] = 0.75
818+
kwargs_trace['opacity'] = 0.6
816819

817820
if 'line' not in kwargs_marker:
818821
if not ggplot2:

plotly/tests/test_optional/test_figure_factory.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,19 @@ def test_data_must_be_dataframe(self):
19351935
ff.create_facet_grid,
19361936
data, 'a', 'b')
19371937

1938+
def test_x_and_y_for_scatter(self):
1939+
data = pd.DataFrame([[0, 0], [1, 1]], columns=['a', 'b'])
1940+
1941+
pattern = (
1942+
"You need to input 'x' and 'y' if you are you are using a "
1943+
"trace_type of 'scatter' or 'scattergl'."
1944+
)
1945+
1946+
self.assertRaisesRegexp(PlotlyError, pattern,
1947+
ff.create_facet_grid,
1948+
data, 'a')
1949+
1950+
19381951
def test_valid_col_selection(self):
19391952
data = pd.DataFrame([[0, 0], [1, 1]], columns=['a', 'b'])
19401953

@@ -2017,10 +2030,11 @@ def test_valid_facet_grid_fig(self):
20172030
)
20182031

20192032
exp_facet_grid = {
2020-
'data': [{'marker': {'color': 'rgba(31, 119, 180, 0.5)',
2033+
'data': [{'marker': {'color': 'rgb(31, 119, 180)',
20212034
'line': {'color': 'darkgrey', 'width': 1},
20222035
'size': 8},
20232036
'mode': 'markers',
2037+
'opacity': 0.6,
20242038
'type': 'scatter',
20252039
'x': [1.8,
20262040
1.8,
@@ -2038,10 +2052,11 @@ def test_valid_facet_grid_fig(self):
20382052
16,
20392053
20],
20402054
'yaxis': 'y1'},
2041-
{'marker': {'color': 'rgba(31, 119, 180, 0.5)',
2055+
{'marker': {'color': 'rgb(31, 119, 180)',
20422056
'line': {'color': 'darkgrey', 'width': 1},
20432057
'size': 8},
20442058
'mode': 'markers',
2059+
'opacity': 0.6,
20452060
'type': 'scatter',
20462061
'x': [2.8,
20472062
2.8,

0 commit comments

Comments
 (0)