Skip to content

Wrong behavior when integrating with a Qt app (PySide2) #662

Open
@ismael-benito

Description

@ismael-benito

Hi!

We are trying to integrate seaborn-image into an app developed at our lab, the app is written in Python+Qt, using PySide2. To be specific the app contains a QMDIArea, where several subwindows can appear, one of them is supposed to be a Matplotlib figure. With Matplotlib this works just fine, however when using isbn.imgplot inside the subclassed matplotlib figure this happens:

image

Another image window is opened. The main reason this occours is in seaborn_image._core:

    def _setup_figure(self):
        """Wrapper to setup image with the desired parameters"""
        if self.ax is None:
            f, ax = plt.subplots()
        else:
            f = plt.gcf()
            ax = self.ax

When providing a matplotlib axes object, I think should use the axes itself to determine the figure rather than pyplot. So, I would say this has to be something like:

   def _setup_figure(self):
       """Wrapper to setup image with the desired parameters"""
       if self.ax is None:
           f, ax = plt.subplots()
       else:
           f = self.ax.get_figure() or plt.gcf()
           ax = self.ax

I might oversighted something and there is a way to deal with this situation in the seaborn-image API, if that is the case, sorry for the inconvenience.

Cheers,

Ismael

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions