Skip to content

Plotting function in BinnedData.py under Data_IO #625

Description

@greendw

Hi,

I was wondering why we have plt.close() (line #419) at the end of the function make_basic_plot in cosipy/data_io/BinnedData.py.
In case you are using Python in terminal (e.g., Ipython, not web-based Notebook), this prevents the plots from appearing.

For example, if you run the following lines (in the tutorial, https://github.com/cositools/cosipy/blob/main/docs/tutorials/DataIO/DataIO_example.ipynb), the plots appear and disappear very quickly like in 0.1 second due to the plt.close() above.

analysis.get_raw_spectrum(show_plots=True)
analysis.get_raw_lightcurve(show_plots=True)

So, unless there is a particular reason of plt.close(), I think it should be removed (or make it optional by adding a new parameter into the function). What do you think about this?

edit: I see that this happens to other examples in DataIO tutorial too. Thus, the suggestion may apply to other plotting functions in cosipy/data_io/BinnedData.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions