Skip to content

Commit 1257a1b

Browse files
author
wjm41
committed
symbol col support
1 parent 990222c commit 1257a1b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

molplotly/main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ def add_molecules(
133133
caption_cols: list[str] = None,
134134
caption_transform: dict[str, Callable] = {},
135135
color_col: str = None,
136+
symbol_col: str = None,
136137
marker_col: str = None,
137138
facet_col: str = None,
138139
wrap: bool = True,
@@ -179,6 +180,8 @@ def add_molecules(
179180
the key must correspond to one of the columns in subset or tooltip (default {}).
180181
color_col : str, optional
181182
name of the column in df that is used to color the datapoints in df - necessary when there is discrete conditional coloring (default None).
183+
symbol_col : str, optional
184+
name of the column in df that is used to determine the symbols of the datapoints in df (default None).
182185
marker_col : str, optional
183186
name of the column in df that is used to determine the marker shape of the datapoints in df (default None).
184187
facet_col : str, optional
@@ -197,6 +200,8 @@ def add_molecules(
197200
df_data = df.copy()
198201
if color_col is not None:
199202
df_data[color_col] = df_data[color_col].astype(str)
203+
if symbol_col is not None:
204+
df_data[symbol_col] = df_data[symbol_col].astype(str)
200205
if marker_col is not None:
201206
df_data[marker_col] = df_data[marker_col].astype(str)
202207
if facet_col is not None:
@@ -211,8 +216,11 @@ def add_molecules(
211216
cols.append(color_col)
212217
if marker_col is not None:
213218
cols.append(marker_col)
219+
if symbol_col is not None:
220+
cols.append(symbol_col)
214221
if facet_col is not None:
215222
cols.append(facet_col)
223+
cols = list(set(cols))
216224
_, curve_dict = find_grouping(fig, df_data, cols)
217225
else:
218226
colors = {0: "black"}

0 commit comments

Comments
 (0)