Beispiel #1
0
def set_ipython_plot_backend(backend='qt'):
    """
    Set matplotlib backend within an ipython shell. Ths function has the
    same effect as the line magic ``%matplotlib [backend]`` but is called
    as a function and includes a check to determine whether the code is
    running in an ipython shell, so that it can safely be used within a
    normal python script since it has no effect when not running in an
    ipython shell.

    Parameters
    ----------
    backend : string, optional (default 'qt')
      Name of backend to be passed to the ``%matplotlib`` line magic
      command
    """

    from sporco.util import in_ipython
    if in_ipython():
        # See https://stackoverflow.com/questions/35595766
        get_ipython().run_line_magic('matplotlib', backend)
Beispiel #2
0
def set_ipython_plot_backend(backend='qt'):
    """
    Set matplotlib backend within an ipython shell. Ths function has the
    same effect as the line magic ``%matplotlib [backend]`` but is called
    as a function and includes a check to determine whether the code is
    running in an ipython shell, so that it can safely be used within a
    normal python script since it has no effect when not running in an
    ipython shell.

    Parameters
    ----------
    backend : string, optional (default 'qt')
      Name of backend to be passed to the ``%matplotlib`` line magic
      command
    """

    from sporco.util import in_ipython
    if in_ipython():
        # See https://stackoverflow.com/questions/35595766
        get_ipython().run_line_magic('matplotlib', backend)
Beispiel #3
0
 def test_26(self):
     val = util.in_ipython()
     assert val is True or val is False
Beispiel #4
0
 def test_26(self):
     val = util.in_ipython()
     assert val is True or val is False