pycroscopy / sidpy

Python utilities for storing, processing, and visualizing spectroscopic and imaging data
https://pycroscopy.github.io/sidpy/
MIT License
11 stars 14 forks source link

Dataset.plot() to return figure handle #136

Closed ssomnath closed 2 years ago

ssomnath commented 2 years ago

Dataset.plot() should return at least the figure handle, and if possible the axes within this figure. This will serve two purposes:

  1. It will provide the ability to easily write the figure to an image file
  2. It will enable editing of the axes / image after the plot has been generated.

Currently, the workaround is to use plt.gcf() and plt.gca() which is not ideal.

gduscher commented 2 years ago

dataset.plot() leaves a handle to figure and axis in dataset.view at this point. datset.view has attributes :

This should be made more clear in the documentation

ssomnath commented 2 years ago

It is fine that these things are saved in the dataset's properties. However, we should return these handles for the plot() function as well. This way, there isn't anything to go looking for.