From 0e1210a4cb92e4c26e2802a6b441f6e227f89593 Mon Sep 17 00:00:00 2001 From: Alyssa Travitz Date: Mon, 2 Feb 2026 14:22:58 -0800 Subject: [PATCH 1/3] fix ligand network cropping bug --- src/openfe/utils/atommapping_network_plotting.py | 2 +- src/openfecli/commands/view_ligand_network.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/openfe/utils/atommapping_network_plotting.py b/src/openfe/utils/atommapping_network_plotting.py index 844dcc994..3b68191d0 100644 --- a/src/openfe/utils/atommapping_network_plotting.py +++ b/src/openfe/utils/atommapping_network_plotting.py @@ -167,6 +167,6 @@ 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 diff --git a/src/openfecli/commands/view_ligand_network.py b/src/openfecli/commands/view_ligand_network.py index 24125907a..b2e17c355 100644 --- a/src/openfecli/commands/view_ligand_network.py +++ b/src/openfecli/commands/view_ligand_network.py @@ -28,6 +28,11 @@ def view_ligand_network(ligand_network: os.PathLike): network = LigandNetwork.from_graphml(graphml) fig = plot_atommapping_network(network) + 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 matplotlib.pyplot.show() From e33127fb4648f0bfd4e0d07823a816248206e03e Mon Sep 17 00:00:00 2001 From: Alyssa Travitz Date: Mon, 2 Feb 2026 14:33:39 -0800 Subject: [PATCH 2/3] move to upstream func --- news/fix_image_crop.rst | 23 +++++++++++++++++++ .../utils/atommapping_network_plotting.py | 10 ++++++-- src/openfecli/commands/view_ligand_network.py | 6 +---- 3 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 news/fix_image_crop.rst diff --git a/news/fix_image_crop.rst b/news/fix_image_crop.rst new file mode 100644 index 000000000..3d1f1d31c --- /dev/null +++ b/news/fix_image_crop.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**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 `_). + +**Security:** + +* diff --git a/src/openfe/utils/atommapping_network_plotting.py b/src/openfe/utils/atommapping_network_plotting.py index 3b68191d0..13d899d66 100644 --- a/src/openfe/utils/atommapping_network_plotting.py +++ b/src/openfe/utils/atommapping_network_plotting.py @@ -142,7 +142,7 @@ def xy(self): class AtomMappingNetworkDrawing(GraphDrawing): """ - Class for drawing atom mappings from a provided ligang network. + Class for drawing atom mappings from a provided ligand network. Parameters ---------- @@ -169,4 +169,10 @@ def plot_atommapping_network(network: LigandNetwork): :class:`matplotlib.figure.Figure` : 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 diff --git a/src/openfecli/commands/view_ligand_network.py b/src/openfecli/commands/view_ligand_network.py index b2e17c355..6a9e04f03 100644 --- a/src/openfecli/commands/view_ligand_network.py +++ b/src/openfecli/commands/view_ligand_network.py @@ -28,11 +28,7 @@ def view_ligand_network(ligand_network: os.PathLike): network = LigandNetwork.from_graphml(graphml) fig = plot_atommapping_network(network) - 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 + matplotlib.pyplot.show() From 8737bc3f91f9b9d5633af674ab171bf0108314fb Mon Sep 17 00:00:00 2001 From: Alyssa Travitz Date: Mon, 2 Feb 2026 14:54:28 -0800 Subject: [PATCH 3/3] whitespace --- src/openfecli/commands/view_ligand_network.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/openfecli/commands/view_ligand_network.py b/src/openfecli/commands/view_ligand_network.py index 6a9e04f03..24125907a 100644 --- a/src/openfecli/commands/view_ligand_network.py +++ b/src/openfecli/commands/view_ligand_network.py @@ -28,7 +28,6 @@ def view_ligand_network(ligand_network: os.PathLike): network = LigandNetwork.from_graphml(graphml) fig = plot_atommapping_network(network) - matplotlib.pyplot.show()