3
���h�F � @ s� d Z ddlmZ ddlZddlZddlZddlZddl m
Z
mZ ddlm
Z
dd� Zd d
� Zd%dd
�Zd&dd�Zdd� Zd'dd�Zdd� ZG dd� de�Zdd� Zedd� �Zedd� �Zedd � �Zd!d"� Zed#d$� �ZdS )(zw
Use this module directly:
import xarray.plot as xplt
Or use the methods on a DataArray:
DataArray.plot._____
� )�divisionN� )�_determine_cmap_params�_infer_xy_labels)� FacetGridc s t � fdd�|D ��S )z>
Is the numpy array a sub dtype of anything in types?
c 3 s | ]}t j� j|�V qd S )N)�np�
issubdtype�dtype)�.0�t)�arr� �0/tmp/pip-build-5_djhm0z/xray/xarray/plot/plot.py� <genexpr> s z_right_dtype.<locals>.<genexpr>)�any)r �typesr
)r r �_right_dtype s r c s6 t jt jt jt jg� t� fdd�| D ��s2td��dS )z\
Raise exception if there is anything in args that can't be plotted on
an axis.
c 3 s | ]}t tj|�� �V qd S )N)r r �array)r
�x)� plottypesr
r r $ s z$_ensure_plottable.<locals>.<genexpr>z5Plotting requires coordinates to be numeric or dates.N)r Zfloating�integerZtimedelta64�
datetime64r � TypeError)�argsr
)r r �_ensure_plottable s r � c
K sD |
j dd�}|dk rtd��t| |||||| d�}|j|||f|
�S )z�
Convenience method to call xarray.plot.FacetGrid from 2d plotting methods
kwargs are the arguments to 2d plotting method
�axNz)Can't use axes when making faceted plots.)�data�col�row�col_wrap�aspect�size�subplot_kws)�pop�
ValueErrorr Z
map_dataarray)
�darray�plotfuncr �yr r r r! r" |