本文整理汇总了Python中matplotlib.tri.triangulation.Triangulation.get_from_args_and_kwargs方法的典型用法代码示例。如果您正苦于以下问题:Python Triangulation.get_from_args_and_kwargs方法的具体用法?Python Triangulation.get_from_args_and_kwargs怎么用?Python Triangulation.get_from_args_and_kwargs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.tri.triangulation.Triangulation
的用法示例。
在下文中一共展示了Triangulation.get_from_args_and_kwargs方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _contour_args
# 需要导入模块: from matplotlib.tri.triangulation import Triangulation [as 别名]
# 或者: from matplotlib.tri.triangulation.Triangulation import get_from_args_and_kwargs [as 别名]
def _contour_args(self, args, kwargs):
if self.filled:
fn = 'contourf'
else:
fn = 'contour'
tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args,
**kwargs)
z = np.asarray(args[0])
if z.shape != tri.x.shape:
raise ValueError('z array must have same length as triangulation x'
' and y arrays')
self.zmax = z.max()
self.zmin = z.min()
if self.logscale and self.zmin <= 0:
raise ValueError('Cannot %s log of negative values.' % fn)
self._contour_level_args(z, args[1:])
return (tri, z)
示例2: _contour_args
# 需要导入模块: from matplotlib.tri.triangulation import Triangulation [as 别名]
# 或者: from matplotlib.tri.triangulation.Triangulation import get_from_args_and_kwargs [as 别名]
def _contour_args(self, args, kwargs):
if self.filled:
fn = 'contourf'
else:
fn = 'contour'
tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args,
**kwargs)
z = np.asarray(args[0])
if z.shape != tri.x.shape:
raise ValueError('z array must have same length as triangulation x'
'and y arrays')
self.zmax = z.max()
self.zmin = z.min()
if self.logscale and self.zmin <= 0:
raise ValueError('Cannot %s log of negative values.' % fn)
self._contour_level_args(z, args[1:])
return (tri, z)
示例3: _contour_args
# 需要导入模块: from matplotlib.tri.triangulation import Triangulation [as 别名]
# 或者: from matplotlib.tri.triangulation.Triangulation import get_from_args_and_kwargs [as 别名]
def _contour_args(self, args, kwargs):
if self.filled: fn = 'contourf'
else: fn = 'contour'
tri, args, kwargs = \
Triangulation.get_from_args_and_kwargs(*args, **kwargs)
z = np.asarray(args[0])
if z.shape != tri.x.shape:
raise ValueError('z array must have same length as triangulation x'
'and y arrays')
self.zmax = z.max()
self.zmin = z.min()
if self.logscale and self.zmin <= 0:
raise ValueError('Cannot %s log of negative values.' % fn)
self._contour_level_args(z, args[1:])
return (tri, z)
示例4: _contour_args
# 需要导入模块: from matplotlib.tri.triangulation import Triangulation [as 别名]
# 或者: from matplotlib.tri.triangulation.Triangulation import get_from_args_and_kwargs [as 别名]
def _contour_args(self, args, kwargs):
if self.filled:
fn = 'contourf'
else:
fn = 'contour'
tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args,
**kwargs)
z = np.ma.asarray(args[0])
if z.shape != tri.x.shape:
raise ValueError('z array must have same length as triangulation x'
' and y arrays')
# z values must be finite, only need to check points that are included
# in the triangulation.
z_check = z[np.unique(tri.get_masked_triangles())]
if np.ma.is_masked(z_check):
raise ValueError('z must not contain masked points within the '
'triangulation')
if not np.isfinite(z_check).all():
raise ValueError('z array must not contain non-finite values '
'within the triangulation')
z = np.ma.masked_invalid(z, copy=False)
self.zmax = float(z_check.max())
self.zmin = float(z_check.min())
if self.logscale and self.zmin <= 0:
raise ValueError('Cannot %s log of negative values.' % fn)
self._contour_level_args(z, args[1:])
return (tri, z)
示例5: tricontour
# 需要导入模块: from matplotlib.tri.triangulation import Triangulation [as 别名]
# 或者: from matplotlib.tri.triangulation.Triangulation import get_from_args_and_kwargs [as 别名]
def tricontour(self, *args,
extend3d=False, stride=5, zdir='z', offset=None, **kwargs):
"""
Create a 3D contour plot.
========== ================================================
Argument Description
========== ================================================
*X*, *Y*, Data values as numpy.arrays
*Z*
*extend3d* Whether to extend contour in 3D (default: False)
*stride* Stride (step size) for extending contour
*zdir* The direction to use: x, y or z (default)
*offset* If specified plot a projection of the contour
lines on this position in plane normal to zdir
========== ================================================
Other keyword arguments are passed on to
:func:`~matplotlib.axes.Axes.tricontour`
Returns a :class:`~matplotlib.axes.Axes.contour`
.. versionchanged:: 1.3.0
Added support for custom triangulations
EXPERIMENTAL: This method currently produces incorrect output due to a
longstanding bug in 3D PolyCollection rendering.
"""
had_data = self.has_data()
tri, args, kwargs = Triangulation.get_from_args_and_kwargs(
*args, **kwargs)
X = tri.x
Y = tri.y
if 'Z' in kwargs:
Z = kwargs.pop('Z')
else:
Z = args[0]
# We do this so Z doesn't get passed as an arg to Axes.tricontour
args = args[1:]
jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
tri = Triangulation(jX, jY, tri.triangles, tri.mask)
cset = super().tricontour(tri, jZ, *args, **kwargs)
self.add_contour_set(cset, extend3d, stride, zdir, offset)
self.auto_scale_xyz(X, Y, Z, had_data)
return cset
示例6: tricontourf
# 需要导入模块: from matplotlib.tri.triangulation import Triangulation [as 别名]
# 或者: from matplotlib.tri.triangulation.Triangulation import get_from_args_and_kwargs [as 别名]
def tricontourf(self, *args, zdir='z', offset=None, **kwargs):
"""
Create a 3D contourf plot.
========== ================================================
Argument Description
========== ================================================
*X*, *Y*, Data values as numpy.arrays
*Z*
*zdir* The direction to use: x, y or z (default)
*offset* If specified plot a projection of the contour
lines on this position in plane normal to zdir
========== ================================================
Other keyword arguments are passed on to
:func:`~matplotlib.axes.Axes.tricontour`
Returns a :class:`~matplotlib.axes.Axes.contour`
.. versionchanged :: 1.3.0
Added support for custom triangulations
EXPERIMENTAL: This method currently produces incorrect output due to a
longstanding bug in 3D PolyCollection rendering.
"""
had_data = self.has_data()
tri, args, kwargs = Triangulation.get_from_args_and_kwargs(
*args, **kwargs)
X = tri.x
Y = tri.y
if 'Z' in kwargs:
Z = kwargs.pop('Z')
else:
Z = args[0]
# We do this so Z doesn't get passed as an arg to Axes.tricontourf
args = args[1:]
jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
tri = Triangulation(jX, jY, tri.triangles, tri.mask)
cset = super().tricontourf(tri, jZ, *args, **kwargs)
self.add_contourf_set(cset, zdir, offset)
self.auto_scale_xyz(X, Y, Z, had_data)
return cset
示例7: tricontour
# 需要导入模块: from matplotlib.tri.triangulation import Triangulation [as 别名]
# 或者: from matplotlib.tri.triangulation.Triangulation import get_from_args_and_kwargs [as 别名]
def tricontour(self, *args, **kwargs):
"""
Create a 3D contour plot.
========== ================================================
Argument Description
========== ================================================
*X*, *Y*, Data values as numpy.arrays
*Z*
*extend3d* Whether to extend contour in 3D (default: False)
*stride* Stride (step size) for extending contour
*zdir* The direction to use: x, y or z (default)
*offset* If specified plot a projection of the contour
lines on this position in plane normal to zdir
========== ================================================
Other keyword arguments are passed on to
:func:`~matplotlib.axes.Axes.tricontour`
Returns a :class:`~matplotlib.axes.Axes.contour`
.. versionchanged:: 1.3.0
Added support for custom triangulations
EXPERIMENTAL: This method currently produces incorrect output due to a
longstanding bug in 3D PolyCollection rendering.
"""
extend3d = kwargs.pop('extend3d', False)
stride = kwargs.pop('stride', 5)
zdir = kwargs.pop('zdir', 'z')
offset = kwargs.pop('offset', None)
had_data = self.has_data()
tri, args, kwargs = Triangulation.get_from_args_and_kwargs(
*args, **kwargs)
X = tri.x
Y = tri.y
if 'Z' in kwargs:
Z = kwargs.pop('Z')
else:
Z = args[0]
# We do this so Z doesn't get passed as an arg to Axes.tricontour
args = args[1:]
jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
tri = Triangulation(jX, jY, tri.triangles, tri.mask)
cset = Axes.tricontour(self, tri, jZ, *args, **kwargs)
self.add_contour_set(cset, extend3d, stride, zdir, offset)
self.auto_scale_xyz(X, Y, Z, had_data)
return cset
示例8: tricontourf
# 需要导入模块: from matplotlib.tri.triangulation import Triangulation [as 别名]
# 或者: from matplotlib.tri.triangulation.Triangulation import get_from_args_and_kwargs [as 别名]
def tricontourf(self, *args, **kwargs):
"""
Create a 3D contourf plot.
========== ================================================
Argument Description
========== ================================================
*X*, *Y*, Data values as numpy.arrays
*Z*
*zdir* The direction to use: x, y or z (default)
*offset* If specified plot a projection of the contour
lines on this position in plane normal to zdir
========== ================================================
Other keyword arguments are passed on to
:func:`~matplotlib.axes.Axes.tricontour`
Returns a :class:`~matplotlib.axes.Axes.contour`
.. versionchanged :: 1.3.0
Added support for custom triangulations
EXPERIMENTAL: This method currently produces incorrect output due to a
longstanding bug in 3D PolyCollection rendering.
"""
zdir = kwargs.pop('zdir', 'z')
offset = kwargs.pop('offset', None)
had_data = self.has_data()
tri, args, kwargs = Triangulation.get_from_args_and_kwargs(
*args, **kwargs)
X = tri.x
Y = tri.y
if 'Z' in kwargs:
Z = kwargs.pop('Z')
else:
Z = args[0]
# We do this so Z doesn't get passed as an arg to Axes.tricontourf
args = args[1:]
jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
tri = Triangulation(jX, jY, tri.triangles, tri.mask)
cset = Axes.tricontourf(self, tri, jZ, *args, **kwargs)
self.add_contourf_set(cset, zdir, offset)
self.auto_scale_xyz(X, Y, Z, had_data)
return cset
示例9: tricontour
# 需要导入模块: from matplotlib.tri.triangulation import Triangulation [as 别名]
# 或者: from matplotlib.tri.triangulation.Triangulation import get_from_args_and_kwargs [as 别名]
def tricontour(self, *args,
extend3d=False, stride=5, zdir='z', offset=None, **kwargs):
"""
Create a 3D contour plot.
.. versionchanged:: 1.3.0
Added support for custom triangulations
.. note::
This method currently produces incorrect output due to a
longstanding bug in 3D PolyCollection rendering.
Parameters
----------
X, Y, Z : array-likes
Input data.
extend3d : bool
Whether to extend contour in 3D; defaults to False.
stride : int
Step size for extending contour.
zdir : {'x', 'y', 'z'}
The direction to use; defaults to 'z'.
offset : scalar
If specified, plot a projection of the contour lines at this
position in a plane normal to zdir
*args, **kwargs
Other arguments are forwarded to `matplotlib.axes.Axes.tricontour`.
Returns
-------
matplotlib.tri.tricontour.TriContourSet
"""
had_data = self.has_data()
tri, args, kwargs = Triangulation.get_from_args_and_kwargs(
*args, **kwargs)
X = tri.x
Y = tri.y
if 'Z' in kwargs:
Z = kwargs.pop('Z')
else:
Z = args[0]
# We do this so Z doesn't get passed as an arg to Axes.tricontour
args = args[1:]
jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
tri = Triangulation(jX, jY, tri.triangles, tri.mask)
cset = super().tricontour(tri, jZ, *args, **kwargs)
self.add_contour_set(cset, extend3d, stride, zdir, offset)
self.auto_scale_xyz(X, Y, Z, had_data)
return cset
示例10: tricontourf
# 需要导入模块: from matplotlib.tri.triangulation import Triangulation [as 别名]
# 或者: from matplotlib.tri.triangulation.Triangulation import get_from_args_and_kwargs [as 别名]
def tricontourf(self, *args, zdir='z', offset=None, **kwargs):
"""
Create a 3D filled contour plot.
.. note::
This method currently produces incorrect output due to a
longstanding bug in 3D PolyCollection rendering.
Parameters
----------
X, Y, Z : array-likes
Input data.
zdir : {'x', 'y', 'z'}
The direction to use; defaults to 'z'.
offset : scalar
If specified, plot a projection of the contour lines at this
position in a plane normal to zdir
*args, **kwargs
Other arguments are forwarded to
`matplotlib.axes.Axes.tricontourf`.
Returns
-------
matplotlib.tri.tricontour.TriContourSet
Notes
-----
.. versionadded:: 1.1.0
The *zdir* and *offset* parameters.
.. versionchanged:: 1.3.0
Added support for custom triangulations
"""
had_data = self.has_data()
tri, args, kwargs = Triangulation.get_from_args_and_kwargs(
*args, **kwargs)
X = tri.x
Y = tri.y
if 'Z' in kwargs:
Z = kwargs.pop('Z')
else:
Z = args[0]
# We do this so Z doesn't get passed as an arg to Axes.tricontourf
args = args[1:]
jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
tri = Triangulation(jX, jY, tri.triangles, tri.mask)
cset = super().tricontourf(tri, jZ, *args, **kwargs)
self.add_contourf_set(cset, zdir, offset)
self.auto_scale_xyz(X, Y, Z, had_data)
return cset