@@ -205,6 +205,11 @@ def surface_plot(node_values : np.ndarray|None=None,
205205 Camera distance.
206206 size : tuple[int, int] or None
207207 Plotter window size.
208+ interactive : bool
209+ Show the interactive plot window
210+ save_as : bool
211+ Save plot (can be interactively manipulated first)
212+ Options are: "png", "jpeg", "jpg", "bmp", "tif", "tiff", "svg", "eps", "ps", "pdf", "tex".
208213 """
209214 # Input validation / normalization
210215 if node_values is None :
@@ -327,17 +332,18 @@ def _map_to_vertices(parc):
327332 cam_pos [axis_idx [axis ]] += sign * distance
328333 pl .camera_position = [tuple (cam_pos ), center , up ]
329334
330-
335+ # Show and save
331336 if interactive :
332337 pl .show (auto_close = False )
333- if save_as is not None :
334- pl .save_graphic (f"surface_plot.{ save_as } " , raster = False )
338+
339+ if save_as in ("svg" , "pdf" , "eps" , "ps" ):
340+ pl .save_graphic (f"surface_plot.{ save_as } " , raster = False )
341+ elif save_as in ("png" , "jpeg" , "jpg" , "bmp" , "tif" , "tiff" ):
342+ pl .screenshot (f"surface_plot.{ save_as } " )
335343 else :
336- if save_as is not None :
337- pl .save_graphic (f"surface_plot.{ save_as } " , raster = False )
338-
339- pl .close ()
340- return
344+ pass
345+
346+ return pl .close ()
341347
342348def get_networks (labels : list [str ]) -> tuple [list [str ], np .ndarray , list [str ], dict [str , int ]]:
343349 """
0 commit comments