Skip to content

Commit

Permalink
fix axis inversion
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Coder committed Jul 31, 2024
1 parent 4ec1d93 commit 16b936f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ogdf_python/matplotlib/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(self, GA, ax=None, add_nodes=True, add_edges=True,
self._on_click_cid = self.ax.figure.canvas.mpl_connect('button_press_event', self._on_click)
self.ax.figure.canvas.mpl_connect('close_event', lambda e: self.addition_timer.stop())

def set_graph(self, GA, add_nodes=True, add_edges=True, apply_style=True, hide_spines=True):
def set_graph(self, GA, add_nodes=True, add_edges=True):
self.reregister(GA.constGraph())
self.GA = GA
G = GA.constGraph()
Expand All @@ -100,10 +100,6 @@ def set_graph(self, GA, add_nodes=True, add_edges=True, apply_style=True, hide_s
if add_edges:
for e in G.edges:
self.add_edge(e)
if apply_style:
self.apply_style()
if hide_spines:
self.hide_spines()

def __del__(self):
self.addition_timer.stop()
Expand Down Expand Up @@ -255,7 +251,9 @@ def cleared(self):
# for r in chain(self.node_labels.values(), self.edge_labels.values(),
# self.style_nodes.values(), self.style_edges.values()):
# r.remove()
inv = self.ax.yaxis.get_inverted() # manually retain this value, all others from apply_style() aren't overwritten
self.ax.clear()
self.ax.yaxis.set_inverted(inv)
# sensible default
self.ax.update_datalim([(0, 0), (100, 100)])
self.ax.autoscale_view()
Expand Down

0 comments on commit 16b936f

Please sign in to comment.