gempy icon indicating copy to clipboard operation
gempy copied to clipboard

2d section auto closes

Open oliveSea opened this issue 11 months ago • 2 comments

Hi all, I am having an issue with plotting 2d sections.

Describe the bug plot_2d does not generate plots as expected.

To Reproduce

  1. Run example https://docs.gempy.org/tutorials/ch1_fundamentals/ch1_3b_cross_sections.html#sphx-glr-tutorials-ch1-fundamentals-ch1-3b-cross-sections-py
  2. plot_2d generates matplotlib figures that hang for a few seconds and then auto-closes. No exception is raised.

Expected behavior Images plotted as shown in example above.

Desktop (please complete the following information):

  • OS: Win11
  • GemPy Version: 2024.2.0.2

Additional context

  • Installation:
    • conda install numpy matplotlib pandas scipy scikit-learn scikit-image gdal pyvista
    • pip install gempy gempy-viewer
  • pyvista's gpv.plot_3d works fine, simple 2d matplotlib plot works fine as well.

Thanks!

oliveSea avatar Jan 11 '25 23:01 oliveSea

Hi @oliveSea, thanks for your question. Could you specify exactly for which plots in the given example this happens. Is it only for the custo cross sections? Do you encounter the same problem with other uses of gpv.plot_2d? Cheers, Jan

javoha avatar Jan 13 '25 08:01 javoha

Hi @javoha, Thanks for your answer. None of the plot_2d or plot_section_traces commands in the example produced a figure for me. I guess it has to do with figure.show() in plot_2d. Replacing:

if show is True:
    p.fig.show()
    return p

with:

if show is True:
    plt.show()
    return p

worked for me. Is there a parameter in plot_2d to change the mpl interactive mode?

cheers

oliveSea avatar Jan 14 '25 20:01 oliveSea