Skip to content

Commit

Permalink
Fix warning due to styling dtyles, and fix column dtype test failure (#…
Browse files Browse the repository at this point in the history
…238)


Fixes #225
  • Loading branch information
jnothman committed Dec 28, 2023
1 parent 5e970e8 commit 791c556
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion upsetplot/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,10 @@ def plot_matrix(self, ax):
"linewidth": "linewidths",
"linestyle": "linestyles",
"hatch": "hatch"}
styles = pd.DataFrame(styles).reindex(columns=style_columns.keys())
styles = (pd.DataFrame(styles)
.reindex(columns=style_columns.keys())
.astype({"facecolor": 'O',
"edgecolor": 'O', "linewidth": float, "linestyle": 'O', "hatch": 'O'}))
styles["linewidth"].fillna(1, inplace=True)
styles["facecolor"].fillna(self._facecolor, inplace=True)
styles["edgecolor"].fillna(styles["facecolor"], inplace=True)
Expand Down
3 changes: 2 additions & 1 deletion upsetplot/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def test_from_contents_vs_memberships(data, typ, id_column):
assert_series_equal(baseline[id_column].reset_index(drop=True),
pd.Series(['aa', 'bb', 'cc', 'dd', 'ee', 'ff'],
name=id_column))
assert_frame_equal(baseline.drop([id_column], axis=1), expected)
baseline_without_id = baseline.drop([id_column], axis=1)
assert_frame_equal(baseline_without_id, expected, check_column_type=baseline_without_id.shape[1] > 0)


def test_from_contents(typ=set, id_column='id'):
Expand Down

0 comments on commit 791c556

Please sign in to comment.