1. Sam Skillman
  2. yt


Anthony Scopatz  committed fccec7a

re-added improved PWViewerMPL.show_or_save()

  • Participants
  • Parent commits 54de3b5
  • Branches yt

Comments (0)

Files changed (1)

File yt/visualization/plot_window.py

View file
             raise YTNotInsideNotebook
+    def show_or_save(self, name=None, mpl_kwargs=None):
+        """Will attempt to show the plot in in an IPython notebook.  Failing that, the 
+        plot will be saved to disk."""
+        try:
+            return self.show()
+        except YTNotInsideNotebook:
+            return self.save(name=name, mpl_kwargs=mpl_kwargs)
 class SlicePlot(PWViewerMPL):
     r"""Creates a slice plot from a parameter file