fix ligand network cropping bug (#1822)

* fix ligand network cropping bug

* move to upstream func

* whitespace
This commit is contained in:
Alyssa Travitz
2026-02-03 07:52:34 -08:00
committed by GitHub
parent 994b84e664
commit a4292b3e16
2 changed files with 32 additions and 3 deletions

23
news/fix_image_crop.rst Normal file
View File

@@ -0,0 +1,23 @@
**Added:**
* <news item>
**Changed:**
* <news item>
**Deprecated:**
* <news item>
**Removed:**
* <news item>
**Fixed:**
* Fixed bug in ligand network visualization (such as with ``openfe view-ligand-network``) so that ligand names are no longer cut off by the plot border (`PR 1822 <https://github.com/OpenFreeEnergy/openfe/pull/1822>`_).
**Security:**
* <news item>

View File

@@ -142,7 +142,7 @@ class LigandNode(Node):
class AtomMappingNetworkDrawing(GraphDrawing):
"""
Class for drawing atom mappings from a provided ligang network.
Class for drawing atom mappings from a provided ligand network.
Parameters
----------
@@ -167,6 +167,12 @@ def plot_atommapping_network(network: LigandNetwork):
Returns
-------
:class:`matplotlib.figure.Figure` :
the matplotlib figure containing the iteractive visualization
the matplotlib figure containing the interactive visualization
"""
return AtomMappingNetworkDrawing(network.graph).fig
fig = AtomMappingNetworkDrawing(network.graph).fig
axes = fig.axes
for ax in axes:
ax.set_frame_on(False) # remove the black frame
for t in ax.texts:
t.set_clip_on(False) # do not clip the label in the network plot
return fig