File tree Expand file tree Collapse file tree 1 file changed +14
-17
lines changed Expand file tree Collapse file tree 1 file changed +14
-17
lines changed Original file line number Diff line number Diff line change @@ -122,26 +122,23 @@ def to_image(
122
122
_kwargs [k ] = v
123
123
124
124
# Check if we are in a Jupyter notebook or IPython display context
125
+ # If so, conditionally add the maxMols argument
125
126
in_notebook = get_ipython () is not None
126
127
127
- # Create a dictionary of arguments for the MolsToGridImage function
128
- draw_args = {
129
- "mols" : mols ,
130
- "legends" : legends ,
131
- "molsPerRow" : n_cols ,
132
- "useSVG" : use_svg ,
133
- "subImgSize" : mol_size ,
134
- "highlightAtomLists" : _highlight_atom ,
135
- "highlightBondLists" : _highlight_bond ,
136
- "drawOptions" : draw_options ,
137
- ** _kwargs ,
138
- }
139
-
140
- # Conditionally add the maxMols argument if in a notebook
141
128
if in_notebook :
142
- draw_args ["maxMols" ] = max_mols
143
-
144
- image = Draw .MolsToGridImage (** draw_args )
129
+ _kwargs ["maxMols" ] = max_mols
130
+
131
+ image = Draw .MolsToGridImage (
132
+ mols ,
133
+ legends = legends ,
134
+ molsPerRow = n_cols ,
135
+ useSVG = use_svg ,
136
+ subImgSize = mol_size ,
137
+ highlightAtomLists = _highlight_atom ,
138
+ highlightBondLists = _highlight_bond ,
139
+ drawOptions = draw_options ,
140
+ ** _kwargs ,
141
+ )
145
142
146
143
if outfile is not None :
147
144
image_to_file (image , outfile , as_svg = use_svg )
You can’t perform that action at this time.
0 commit comments