OwlCyberSecurity - MANAGER
Edit File: _constrained_layout.cpython-38.pyc
U ��]�u � @ s� d Z ddlZddlZddlmZ ddlmZ e� e �Zdd� Zdd� Z dd� Zdd d �Zdd� Zd d� Zdd� Zddd�Zddd�Zdd� Zddd�ZdS )a� This module provides the routine to adjust subplot layouts so that there are no overlapping axes or axes decorations. All axes decorations are dealt with (labels, ticks, titles, ticklabels) and some dependent artists are also dealt with (colorbar, suptitle, legend). Layout is done via :meth:`~matplotlib.gridspec`, with one constraint per gridspec, so it is possible to have overlapping axes if the gridspecs overlap (i.e. using :meth:`~matplotlib.gridspec.GridSpecFromSubplotSpec`). Axes placed using ``figure.subplots()`` or ``figure.add_subplots()`` will participate in the layout. Axes manually placed via ``figure.add_axes()`` will not. See Tutorial: :doc:`/tutorials/intermediate/constrainedlayout_guide` � Nc C s0 || ko|kn p.|| ko*|kS S �N� )� colnum0min� colnum0max� colnumCmin� colnumCmaxr r �@/usr/lib/python3/dist-packages/matplotlib/_constrained_layout.py�_in_same_column: s �r c C s0 || ko|kn p.|| ko*|kS S r r )� rownum0min� rownum0max� rownumCmin� rownumCmaxr r r �_in_same_row? s �r c C sB | j D ]6}|jdk r|j�� }|d dks6|d dkr dS qdS )zw helper function to make sure all axes in the figure have a finite width and height. If not, return False N� r � FT)�axes� _layoutbox� _poslayoutbox�get_rect)�fig�ax�newposr r r �_axes_all_finite_sizedD s r c C s | j �� j}t� }| jD ].}t|d�r|�� �� } | jdk r|� | � qt |�dkr^t�d� | jj dk r~|D ]} t| | � qntd�D �]�} | jD ](}t�|j� |jdk r�t||||� q�| j}|dk o�|jdk o�|�� }|�r||j|d��} | j| j }t�|��r|j�||d � | jj dk �rn| j}|jD ]}|�� �r8t|||d� �q8|D ]} t| | � �q\| j j d7 _ | j�� t | ��r| jD ]*}|jdk �r�|j!�"� }|j#|d d � �q�|�r�|j�"� }|�$d| � n"|dk �r|jdk �r|j�d� q�t�d� q�dS ) a� Do the constrained_layout. Called at draw time in ``figure.constrained_layout()`` Parameters ---------- fig : Figure is the ``figure`` instance to do the layout in. renderer : Renderer the renderer to use. h_pad, w_pad : float are in figure-normalized units, and are a padding around the axes elements. hspace, wspace : float are in fractions of the subplot sizes. �get_subplotspecNr zgThere are no gridspecs with layoutboxes. Possibly did not call parent GridSpec with the figure= keyword� r ��renderer��hspace�wspace�original)Zwhichg �?zUconstrained_layout not applied. At least one axes collapsed to zero width or height.)%�transFigure�inverted�transform_bbox�setr �hasattrr �get_gridspecr �add�len�cbookZ_warn_external�constrained_layout_called�_make_ghost_gridspec_slots�range�_log�debug�_make_layout_marginsZ _suptitleZ get_in_layoutZget_window_extent�y1�y0�np�isfiniteZedit_height�children�_is_gridspec_layoutbox�_arrange_subplotspecs� _align_spinesZupdate_variablesr r r Z _set_positionZset_y)r r �h_pad�w_padr r �invTransFigZgssr �gsZnnnZsuptitleZdo_suptitle�bbox�heightZfiglb�childr r r r �do_constrained_layoutR sd A �� � r? c C s� |� � \}}tj|| td�}g }| jD ]2}t|d�r(|jdk r(|�� �� |kr(||g7 }q(|D ]2}|�� }|j dkr~|j |_ d||j |j d �<