GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add fit graph button · ogdf/ogdf-python@1ad00bc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/ogdf_python/matplotlib
    • widget.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/ogdf_python/matplotlib/widget.py‎

Copy file name to clipboardExpand all lines: src/ogdf_python/matplotlib/widget.py
+11-2Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def update_all(self, autoscale=True):
153153
if e in self.edge_styles:
154154
self.update_edge(e)
155155
if autoscale:
156+
self.ax.ignore_existing_data_limits = True
156157
for col in chain((s.coll for s in self.style_nodes.values()), (s.coll for s in self.style_edges.values())):
157158
self.ax.update_datalim(col.get_datalim(self.ax.transData).get_points())
158159
self.ax.autoscale_view()
@@ -161,7 +162,7 @@ def update_all(self, autoscale=True):
161162
def apply_style(self):
162163
self.ax.set_aspect(1, anchor="C", adjustable="datalim")
163164
self.ax.update_datalim([(0, 0), (100, 100)])
164-
self.ax.autoscale()
165+
self.ax.autoscale(enable=True, axis="both")
165166
self.ax.invert_yaxis()
166167
fig = self.ax.figure
167168
fig.canvas.header_visible = False
@@ -172,9 +173,17 @@ def apply_style(self):
172173
def update(*args, **kwargs):
173174
self.update_all()
174175

176+
def expand(*args, **kwargs):
177+
# autoscale gets disabled by panning
178+
self.ax.autoscale(enable=True, axis="both")
179+
self.update_all(autoscale=True)
180+
175181
fig.canvas.toolbar.update_ogdf_graph = update
182+
fig.canvas.toolbar.expand_ogdf_graph = expand
176183
fig.canvas.toolbar.toolitems = [*fig.canvas.toolbar.toolitems,
177-
("Update", "Update the Graph", "refresh", "update_ogdf_graph")]
184+
("Update", "Update the Graph", "refresh", "update_ogdf_graph"),
185+
("Fit Graph", "Show the full graph", "expand",
186+
"expand_ogdf_graph")] # arrows-alt
178187
fig.canvas.toolbar_visible = 'visible'
179188

180189
def hide_spines(self):

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.