@@ -153,6 +153,7 @@ def update_all(self, autoscale=True): |
153 | 153 | if e in self.edge_styles: |
154 | 154 | self.update_edge(e) |
155 | 155 | if autoscale: |
| 156 | + self.ax.ignore_existing_data_limits = True |
156 | 157 | for col in chain((s.coll for s in self.style_nodes.values()), (s.coll for s in self.style_edges.values())): |
157 | 158 | self.ax.update_datalim(col.get_datalim(self.ax.transData).get_points()) |
158 | 159 | self.ax.autoscale_view() |
@@ -161,7 +162,7 @@ def update_all(self, autoscale=True): |
161 | 162 | def apply_style(self): |
162 | 163 | self.ax.set_aspect(1, anchor="C", adjustable="datalim") |
163 | 164 | self.ax.update_datalim([(0, 0), (100, 100)]) |
164 | | - self.ax.autoscale() |
| 165 | + self.ax.autoscale(enable=True, axis="both") |
165 | 166 | self.ax.invert_yaxis() |
166 | 167 | fig = self.ax.figure |
167 | 168 | fig.canvas.header_visible = False |
@@ -172,9 +173,17 @@ def apply_style(self): |
172 | 173 | def update(*args, **kwargs): |
173 | 174 | self.update_all() |
174 | 175 |
|
| 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 | + |
175 | 181 | fig.canvas.toolbar.update_ogdf_graph = update |
| 182 | + fig.canvas.toolbar.expand_ogdf_graph = expand |
176 | 183 | 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 |
178 | 187 | fig.canvas.toolbar_visible = 'visible' |
179 | 188 |
|
180 | 189 | def hide_spines(self): |
|