| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/IPython/core/magics/__pycache__/ |
Upload File : |
�
�@�c� �
� � d Z ddlmZ ddlmZ ddlmZmZmZ ddl m
Z
ddlmZ ddl
mZ ej dd d
e e e ej � � � � � � � � z �� � Ze G d� d
e� � � � ZdS )z@Implementation of magic functions for matplotlib/pylab support.
� )�Application)�magic_arguments)�Magics�magics_class�
line_magic)�skip_doctest)�warn)�backends�gui�?z�Name of the matplotlib backend to use %s.
If given, the corresponding matplotlib backend is used,
otherwise it will be matplotlib's default
(which you can set in your matplotlib config file).
)�nargs�helpc �D � e Zd ZdZee ej � � ej dddd�� � edd�� � � � � � � � � � Z ee ej � � ej d dd
d�� � edd
�� � � � � � � � � � Z
d� Zd
S )�PylabMagicsz,Magics related to matplotlib's pylab supportz-lz--list�
store_truez"Show available matplotlib backends)�actionr � c � � t j | j |� � }|j r4t t j � � � � }t
d|z � � dS | j � t |j
t � � r|j
� � � n|j
� � \ }}| �
|j
|� � dS )a� Set up matplotlib to work interactively.
This function lets you activate matplotlib interactive support
at any point during an IPython session. It does not import anything
into the interactive namespace.
If you are using the inline matplotlib backend in the IPython Notebook
you can set which figure formats are enabled using the following::
In [1]: from IPython.display import set_matplotlib_formats
In [2]: set_matplotlib_formats('pdf', 'svg')
The default for inline figures sets `bbox_inches` to 'tight'. This can
cause discrepancies between the displayed image and the identical
image created using `savefig`. This behavior can be disabled using the
`%config` magic::
In [3]: %config InlineBackend.print_figure_kwargs = {'bbox_inches':None}
In addition, see the docstring of
`IPython.display.set_matplotlib_formats` and
`IPython.display.set_matplotlib_close` for more information on
changing additional behaviors of the inline backend.
Examples
--------
To enable the inline backend for usage with the IPython Notebook::
In [1]: %matplotlib inline
In this case, where the matplotlib default is TkAgg::
In [2]: %matplotlib
Using matplotlib backend: TkAgg
But you can explicitly request a different GUI backend::
In [3]: %matplotlib qt
You can list the available backends using the -l/--list option::
In [4]: %matplotlib --list
Available matplotlib backends: ['osx', 'qt4', 'qt5', 'gtk3', 'gtk4', 'notebook', 'wx', 'qt', 'nbagg',
'gtk', 'tk', 'inline']
z!Available matplotlib backends: %sN)r �parse_argstring�
matplotlib�listr
�keys�print�shell�enable_matplotlib�
isinstancer �str�lower�_show_matplotlib_backend)�self�line�args�
backends_listr �backends �;/usr/lib/python3/dist-packages/IPython/core/magics/pylab.pyr zPylabMagics.matplotlib) s� � �j �.�t���E�E���9� =� �����1�1�M��5�
�E�F�F�F�F�F��:�7�7�J�W[�W_�ad�Le�Le�8s�����8H�8H�8H�ko�ks�t�t�L�C���)�)�$�(�G�<�<�<�<�<� z--no-import-allNz�Prevent IPython from performing ``import *`` into the interactive namespace.
You can govern the default behavior of this flag with the
InteractiveShellApp.pylab_import_all configurable.
)r �defaultr c �� � t j | j |� � }|j �Dt j � � r.t j � � } |j }n# t $ r d}Y nw xY wd}n|j }| j �
|j |�� � \ }}}| � |j |� � t d� � t d� � |rt d|z dz � � dS dS )a Load numpy and matplotlib to work interactively.
This function lets you activate pylab (matplotlib, numpy and
interactive support) at any point during an IPython session.
%pylab makes the following imports::
import numpy
import matplotlib
from matplotlib import pylab, mlab, pyplot
np = numpy
plt = pyplot
from IPython.display import display
from IPython.core.pylabtools import figsize, getfigs
from pylab import *
from numpy import *
If you pass `--no-import-all`, the last two `*` imports will be excluded.
See the %matplotlib magic for more details about activating matplotlib
without affecting the interactive namespace.
NT)�
import_allzO%pylab is deprecated, use %matplotlib inline and import the required libraries.z>Populating the interactive namespace from numpy and matplotlibz.pylab import has clobbered these variables: %sz8
`%matplotlib` prevents importing * from pylab and numpy)r r �pylab�
no_import_allr �initialized�instance�pylab_import_all�AttributeErrorr �enable_pylabr r r r )r r! r"