Skip to content

Feature request: Adding XClass property to interactively created figures #6743

Closed

Description

@00tau

I need your help. I would like to have the window manager to, well, manage the plots, I am creating interactively during an ipython session. When I create a plot:

from numpy import arange
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as pt
pt.ion()

x = arange(-10,10,step=.1)
pt.plot(x, x**2)

And check for the window properties, I get nothing.

% xprop | grep CLASS
WM_CLASS(STRING) = " ", " "

Is it possible to configure matplotlib to add some X-window properties to its plots?

I have installed matplotlib using pip.

pip freeze | grep '\(matplotlib==\)\|\(ipython==\)'
ipython==4.2.0
matplotlib==1.5.1

Thanks!

Activity

  1. added this to the milestone on Jul 15, 2016
  2. tacaswell commented on Jul 15, 2016

    @tacaswell
    Member

    I would also love to be able to do this. Any help sorting out how to do this through the GUI toolkits would be great!

  3. modified the milestones: , on Feb 5, 2017
  4. CJ-Wright commented on Jan 10, 2018

    @CJ-Wright

    I'd very much like this as well!

  5. anntzer commented on Jan 10, 2018

    @anntzer
    Contributor

    Is this not closed by #8394 (i.e. mpl2.1)? (see also #4746 (comment))
    Feel free to request a reopen if I missed something...

  6. CJ-Wright commented on Jan 10, 2018

    @CJ-Wright

    I still get

    $ xprop | grep "WM_CLASS(STRING)"
    WM_CLASS(STRING) = " ", " "
    

    when running

    In [1]: import matplotlib.pyplot as plt
    
    In [2]: %matplotlib
    Using matplotlib backend: Qt5Agg
    
    In [3]: plt.plot()
    Out[3]: []
    
    In [4]: 
    

    with matplotlib installed from conda-forge

    conda list matplotlib
    # packages in environment at foo/mc/envs/dp_dev:
    #
    matplotlib                2.1.1                    py35_0    conda-forge
    ipython                   6.2.1                    py35_0    conda-forge
    ipython_genutils          0.2.0                    py35_0    conda-forge
    
  7. anntzer commented on Jan 10, 2018

    @anntzer
    Contributor

    Well, that's because in your case IPython is setting up the QApplication, not matplotlib. Can you try without IPython?
    matplotlib could use setApplicationName to update the QApp's WM_CLASS, but I think it should not (because in general, matplotlib could just be embedded in some other application that does not want WM_CLASS to be fiddled with).
    So I'd say the issue (if any) should be reported to IPython.

  8. CJ-Wright commented on Jan 10, 2018

    @CJ-Wright

    Without IPython it does work. Would it be possible to have this be settable somewhere?

  9. anntzer commented on Jan 10, 2018

    @anntzer
    Contributor

    It's just a matter of calling QApplication.instance().setApplicationName(...). Again I think this should be IPython's job, because they own the QApp.

  10. tacaswell commented on Jan 11, 2018

    @tacaswell
    Member

    @CJ-Wright you can also do that call and set it to what ever you want (such as xpdacq ;) )

    attn @Carreau can we do this on the IPython side?

  11. CJ-Wright commented on Jan 11, 2018

    @CJ-Wright

    @tacaswell The hope was to use Awesome both at xpd and on my local to place the various windows where they needed to go at instantiation time. What is the best way to access the QApplication and such for an individual plot?

  12. takluyver commented on Jan 11, 2018

    @takluyver
    Contributor

    We (IPython) create the QApplication at a point where we don't know that it's for matplotlib, so we can't set the application name to be matplotlib at that point. But if you can find the right place to put it in our code, a PR would be welcome.

  13. tacaswell commented on Jan 11, 2018

    @tacaswell
    Member

    @CJ-Wright The QApplication is a process singleton, QApplication.instance() will either return the singleton or None.

    Please do not install Awesome on the beamline. If you are going to fill a screen with a fixed set of plots you are probably better off building a Qt Application with embeds all of your plots. That way you only have to maximize it reliably.

  14. anntzer commented on May 9, 2018

    @anntzer
    Contributor

    Closing, as "not a matplotlib issue" (IMO) per the discussion above.

  15. removed
    Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
    on May 9, 2018
  16. removed this from the milestone on May 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions